이렇게 말하면
거의 모든 분이 남이라고 하시더라구요,,유유
암튼 늘 껄쩍지근한 질문만 드려서 미안합니다.
파일업로드 갯수를 늘릴려면 어떻게 해야 하나요?
날짜를 2016-07-26 이렇게 나오게 하려면요?
이런 질문들도 간혹 해야 하는데...유유
또 날짜가 바꿨군요,,,좋은 하루 되세요,..
질문: 댓글에서 체디터5로 멀티사진창에서 이미지를 업로드하는데...
이게 파일명이 랜덤으로 저장되어 리스트에 섬네일로 불러오려는데
장난이 아닙니다.
(간단한) 방법이 있을까요?
체디터 업로드.php를 보니 이렇게 되어 있더군요..
<?php
// ---------------------------------------------------------------------------
// CHXImage
//
// 이 코드는 데모를 위해서 제공됩니다.
// 환경에 맞게 수정 또는 참고하여 사용해 주십시오.
//
// ---------------------------------------------------------------------------
require_once("_config.php");
//----------------------------------------------------------------------------
//
//
$tempfile = $_FILES['file']['tmp_name'];
$filename = md5($_SERVER['REMOTE_ADDR']).'_'.$_FILES['file']['name'];
// 저장 파일 이름
// md5(IP)_년월일시분초_랜덤문자4자.확장자
// 1234567890abcdef1234567890abcdef_20140327125959_abcd.jpg
$savefile = SAVE_DIR . '/' . $filename;
// 사용자PC의 파일 이름: $_POST["origName"]
// 사용자PC의 파일 경로: $_POST["filePath"]
// 사용자PC의 파일 크기: $_POST["filesize"]
// 파일의 확장자가 이미지가 아니라면 삭제
if (!preg_match("/.(gif|jpe?g|png)$/i", $savefile))
unlink($savefile);
move_uploaded_file($tempfile, $savefile);
$imgsize = getimagesize($savefile);
$filesize = filesize($savefile);
if (!$imgsize) {
$filesize = 0;
$random_name = '-ERR';
unlink($savefile);
};
switch ($imgsize[2]) {
case IMAGETYPE_GIF : // 1
case IMAGETYPE_JPEG : // 2
case IMAGETYPE_PNG : // 3
break;
default :
$filesize = 0;
$random_name = '-ERR';
unlink($savefile);
}
$rdata = sprintf('{"fileUrl": "%s/%s", "filePath": "%s", "fileName": "%s", "fileSize": "%d" }',
SAVE_URL,
$filename,
$savefile,
$filename,
$filesize );
echo $rdata;
?>
답변 2개 / 댓글 18개
대충 불러오는 방식은
$query = " select wr_content from ".$write_table." where wr_parent = '".$wr_id."' and wr_is_comment > 0 ";/*한개의 글만 검사 할 때*/ $row = sql_fetch($query);echo get_view_thumbnail($row['wr_content']);/*한개의 글만 검사 할 때*/ /*여러개의 글 검사 할 때*/$result = sql_query($query); for($i=0; $row = sql_fetch_array($result); $i++) { echo get_view_thumbnail($row['wr_content']);}/*여러개의 글 검사 할 때*/
답변에 대한 댓글 12개
개념이 없어 이해는 어렵지만..ㅋ
본문 첨부파일 이미지는 이렇게 불러오던데..
제가 하고자 하는거는 어떻게 불러올지 어렵네요..
<?php
if (!$list[$i]['is_notice']) {
$thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']);
if($thumb['src']) {
$img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'" class="list_img">';
} else {
$img_content = '<img src="'.$board_skin_url.'/img/noimage.gif" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'" class="list_img">';
}
echo $img_content;
}
?>
<a href="<?php echo $list[$i]['href'] ?>">
<?php
if (!$list[$i]['is_notice']) {
$query = " select wr_content from ".$write_table." where wr_parent = '".$list[$i]['wr_id']."' and wr_is_comment > 0 ";
/*여러개의 글 검사 할 때*/
$result = sql_query($query);
for($i=0; $row = sql_fetch_array($result); $i++) {
echo get_view_thumbnail($row['wr_content']);
}
/*여러개의 글 검사 할 때*/
$thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']);
if($thumb['src']) {
$img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'" class="list_img">';
} else {
$img_content = '<img src="'.$board_skin_url.'/img/noimage.gif" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'" class="list_img">';
}
echo $img_content;
}
?>
</a>
내용에 저장된 이미지를 리스트페이지에서 썸네일로 불러오고 싶다는 건가요???
답변에 대한 댓글 6개
본문에 첨부파일로 올린거는 이런식으로 잘 불러왔는데요..
<?php
if (!$list[$i]['is_notice']) {
$thumb1 = get_list_thumbnail_test($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], '', '', '', '', '', '0'); //첫번째파일
if($thumb1['src']) {
$img_content = '<img src="'.$thumb1['src'].'" alt="'.$thumb1['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'">';
} else {
$img_content = '<img src="'.$board_skin_url.'/img/noimage.gif" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'" class="list_img">';
}
echo $img_content;
$thumb2 = get_list_thumbnail_test($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], '', '', '', '', '', '1'); //두번째파일
if($thumb2['src']) {
$img_content_0 = '<img src="'.$thumb2['src'].'" alt="'.$thumb2['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'">';
} else {
$img_content_0 = '<img src="'.$board_skin_url.'/img/noimage.gif" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'" class="list_img">';
}
echo $img_content_0;
}
?>
</a>
답변을 작성하려면 로그인이 필요합니다.
/lib/thumbnail.lib.php 보시면 됩니다