썸네일 이미지를 외부링크로 가져오는 것에 대한 질문입니다. 정보
썸네일 이미지를 외부링크로 가져오는 것에 대한 질문입니다.본문
http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=121268&sca=%EA%B0%A4%EB%9F%AC%EB%A6%AC&page=2
위 게시판을 사용하려고 합니다.
첨부파일로 올린 이미지가 아니라 에디터에서 올린 이미지 혹은 따로 외부 링크된 이미지를 썸네일로 가져와서 사용하고 싶은데 어떻게 해야 좋을지 모르겠어서 질문드립니다.
list.skin.php를 보면
<?
for ($i=0; $i<count($list); $i++) {
$content = $list[$i][wr_content];
// 내용에서 <img.*> 태그의 전체 코드를 얻음
preg_match("/(<img[^>]+>)/i", $content, $matches);
$img = $matches[1];
// <img.*> 태그에서 src 의 코드만 얻음
preg_match("/src\=[\"\']?([^\"\'\s\>]+)/i", $img, $matches);
$src_editor = $matches[1];
$src_image = $g4[path]."/data/file/".$bo_table."/".$list[$i][file][0][file];
$thumb = $thumb_dir."/".$list[$i][file][0][file];
$thumb_editor = $thumb_dir."/".$list[$i][wr_id];
if (!file_exists($thumb)){ //업로드이미지 썸네일 생성
$thumb = create_thumb($src_image, $thumb_width, $thumb_height, $thumb);
} else if (!file_exists($thumb) && $src_editor ){ //업로드이미지가 없을시 에디터이미지 썸네일 생성
$thumb = create_thumb($real_img_url, $thumb_width, $thumb_height, $thumb_editor);
}
if ($list[$i][file][0][file]){
$print_thumb = "<div class=\"item\"><a href=".$list[$i][href]."><img src=".$thumb." class=\"thumb\" /></a></div>";
} else if ($src_editor){
$print_thumb = "<a href=".$list[$i][href]."><img src=".$thumb_editor." class=\"thumb\" /></a>";
} else {
$print_thumb = "<img src=\"{$board_skin_path}/img/noimage.jpg\" />";
}
?>
<li>
<?=$print_thumb?>
<p>
<? if ($is_checkbox) { ?><input type=checkbox name=chk_wr_id[] value="<?=$list[$i][wr_id]?>"><? }?><a href="<?=$list[$i][href]?>" class="title"><?=$list[$i][subject]?></a><span class='comment'> <?=$list[$i][comment_cnt]?></span>
</p>
<p class="c_gray"><?=$list[$i][datetime]?></p>
</li>
<? }?>
</ul>
</form>
라고 되어있는데 "업로드이미지가 없을 경우 에디터이미지 썸네일 생성" 부분을 볼 때 이상이 없는 것 같은데
실제로 업로드이미지가 없는 경우는 무조건 엑박이 됩니다.
어떻게 수정하면 좋을까요ㅜㅜ??
위 게시판을 사용하려고 합니다.
첨부파일로 올린 이미지가 아니라 에디터에서 올린 이미지 혹은 따로 외부 링크된 이미지를 썸네일로 가져와서 사용하고 싶은데 어떻게 해야 좋을지 모르겠어서 질문드립니다.
list.skin.php를 보면
<?
for ($i=0; $i<count($list); $i++) {
$content = $list[$i][wr_content];
// 내용에서 <img.*> 태그의 전체 코드를 얻음
preg_match("/(<img[^>]+>)/i", $content, $matches);
$img = $matches[1];
// <img.*> 태그에서 src 의 코드만 얻음
preg_match("/src\=[\"\']?([^\"\'\s\>]+)/i", $img, $matches);
$src_editor = $matches[1];
$src_image = $g4[path]."/data/file/".$bo_table."/".$list[$i][file][0][file];
$thumb = $thumb_dir."/".$list[$i][file][0][file];
$thumb_editor = $thumb_dir."/".$list[$i][wr_id];
if (!file_exists($thumb)){ //업로드이미지 썸네일 생성
$thumb = create_thumb($src_image, $thumb_width, $thumb_height, $thumb);
} else if (!file_exists($thumb) && $src_editor ){ //업로드이미지가 없을시 에디터이미지 썸네일 생성
$thumb = create_thumb($real_img_url, $thumb_width, $thumb_height, $thumb_editor);
}
if ($list[$i][file][0][file]){
$print_thumb = "<div class=\"item\"><a href=".$list[$i][href]."><img src=".$thumb." class=\"thumb\" /></a></div>";
} else if ($src_editor){
$print_thumb = "<a href=".$list[$i][href]."><img src=".$thumb_editor." class=\"thumb\" /></a>";
} else {
$print_thumb = "<img src=\"{$board_skin_path}/img/noimage.jpg\" />";
}
?>
<li>
<?=$print_thumb?>
<p>
<? if ($is_checkbox) { ?><input type=checkbox name=chk_wr_id[] value="<?=$list[$i][wr_id]?>"><? }?><a href="<?=$list[$i][href]?>" class="title"><?=$list[$i][subject]?></a><span class='comment'> <?=$list[$i][comment_cnt]?></span>
</p>
<p class="c_gray"><?=$list[$i][datetime]?></p>
</li>
<? }?>
</ul>
</form>
라고 되어있는데 "업로드이미지가 없을 경우 에디터이미지 썸네일 생성" 부분을 볼 때 이상이 없는 것 같은데
실제로 업로드이미지가 없는 경우는 무조건 엑박이 됩니다.
어떻게 수정하면 좋을까요ㅜㅜ??
댓글 전체
외부링크 섬네일을 사용하시려면 일단 임시 경로에 이미지 저장후 섬네일을 생성후 임시 파일 삭제 해주시던가 해야 할꺼같은데요.
임시경로에 이미지 저장 후 섬네일 생성 후 임시파일 삭제...라는 게 무슨 의미인지 여쭈어봐도 될까요ㅜㅜ?? 제가 초보라서 정확히 어떻게 해야할지 모르겠어요ㅜㅜ