우리가 남이가? - <고수용버전> 채택완료
이렇게 말하면
거의 모든 분이 남이라고 하시더라구요,,유유
암튼 늘 껄쩍지근한 질문만 드려서 미안합니다.
파일업로드 갯수를 늘릴려면 어떻게 해야 하나요?
날짜를 2016-07-26 이렇게 나오게 하려면요?
이런 질문들도 간혹 해야 하는데...유유
또 날짜가 바꿨군요,,,좋은 하루 되세요,..
질문: 댓글에서 체디터5로 멀티사진창에서 이미지를 업로드하는데...
이게 파일명이 랜덤으로 저장되어 리스트에 섬네일로 불러오려는데
장난이 아닙니다.
(간단한) 방법이 있을까요?
체디터 업로드.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개
대충 불러오는 방식은
$query = " select wr_content from ".$write_table." where wr_parent = '".$wr_id."' and wr_is_comment > 0 ";</p><p>/*한개의 글만 검사 할 때*/ </p><p>$row = sql_fetch($query);</p><p>echo get_view_thumbnail($row['wr_content']);</p><p>/*한개의 글만 검사 할 때*/</p><p> </p><p>/*여러개의 글 검사 할 때*/</p><p>$result = sql_query($query); </p><p>for($i=0; $row = sql_fetch_array($result); $i++) {</p><p> echo get_view_thumbnail($row['wr_content']);</p><p>}</p><p>/*여러개의 글 검사 할 때*/</p><p>
답변에 대한 댓글 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;
}
?>
위 문장중 한개의 글만 검사할때는 빼고
여러개의 글 검사할때의 문장을 가져다가 적용시키세요
$wr_id 값만 $list[$i]['wr_id']로 바꾸면 되겠네요
위 쿼리를 if 닫히는 부분 위쪽에 넣어 주시면 되겠네요
}
<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>
for 구문내의 $i 를 $j 나 이런걸로 바꾸셔야죠
$i 로 쓰면 문제가 생기겠지요 ㅡㅡ
그리고 글 코멘트내용까지 리스트에 나타나구요,,,이건 또 어떻게 손봐야 하나..유유, 쉽지 않네요.,
thumbnail.lip.php도 함께 수정하고 뭔가 작업을 해주어야 하는거죠? 휴
어려운거 시간내주셔서 늘 고맙습니다~
복잡해져서 새로 질문을 올려봐야겠습니다~
좋은 하루되세요~
댓글을 작성하려면 로그인이 필요합니다.
답변에 대한 댓글 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 보시면 됩니다