썸네일 관한질문입니다^^ > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

썸네일 관한질문입니다^^ 정보

썸네일 관한질문입니다^^

본문

최신게시물에 썸네일을 사용하는것 같은데..게시판 수정시 이미지를 바꿀경우 썸네일이 삭제가 되지 않는것 같습니다..어떻게 해야 삭제가 될까요?

아래 latest_skin.php  소스 올립니다


<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$img_width = 80;
$img_height = 60;
$img_quality = 95;

//if (!$board[bo_10]) alert("게시판 설정 : 여분 필드 10 에 리스트 스타일을 설정하십시오. list 또는 webzine 또는 gallery");

if (!$img_width) alert("게시판 설정 : 여분 필드 7 에 목록에서 보여질 이미지의 폭을 설정하십시오. (픽셀 단위)");
if (!$img_height) alert("게시판 설정 : 여분 필드 8 에 목록에서 보여질 이미지의 높이를 설정하십시오. (픽셀 단위)");
if (!$img_quality) alert("게시판 설정 : 여분 필드 9 에 목록에서 보여질 이미지의 질(quality)을 비율로 설정하십시오. (100 이하)");
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");

$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb_egglatest';
@unlink("$thumb_path/$wr_id"); //썸네일 파일명

@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);

?>
 <link rel="stylesheet" href="<?=$latest_skin_path?>/style.css" type="text/css" />
 <div class="egglatest">
 <div class="egglatest_title"><img src='<?=$latest_skin_path?>/img/icon_title.gif'>
 <a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>' title="<?=$board[bo_subject]?>로 이동"><b><?=$board[bo_subject]?></b></a>
 <font style="font-family:돋움;font-size:9pt;color:#999999;l">- 세계속의 한국인!</font></div>
  <ul class="egglatest_list">
 <? for ($i=0; $i<count($list); $i++) { ?>
<?
if($i==0){
    $img = "<img src='$board_skin_path/img/noimage.gif' border=0 width='$img_width' height='$img_height' title='이미지 없음' align=left style='margin-right:5px; border:1 solid #CCCCCC; padding:3px;'>";
    $thumb = $thumb_path.'/'.$list[$i][wr_id];
    // 썸네일 이미지가 존재하지 않는다면
    if (!file_exists($thumb)) {
        $file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
        // 업로드된 파일이 이미지라면
        if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {
            $size = getimagesize($file);
            if ($size[2] == 1)
                $src = imagecreatefromgif($file);
            else if ($size[2] == 2)
                $src = imagecreatefromjpeg($file);
            else if ($size[2] == 3)
                $src = imagecreatefrompng($file);
            else
                break;

            $rate = $img_width / $size[0];
            $height = (int)($size[1] * $rate);

            // 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
            if ($height < $img_height)
                // 계산된 이미지 높이로 복사본 이미지 생성
                $dst = imagecreatetruecolor($img_width, $height);
            else
                // 설정된 이미지 높이로 복사본 이미지 생성
                $dst = imagecreatetruecolor($img_width, $img_height);
            imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
            imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
            chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
           } else { //게디터에서 삽입한 이미지 뽑자ㅠㅠ
   $edit_img = $list[$i]['wr_content'];
   if (eregi("data/cheditor[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // data/cheditor------
    $file = $g4[path]."/" . $tmp[0]; // 파일명
    $size = getimagesize($file);
    if ($size[2] == 1)
     $src = imagecreatefromgif($file);
    else if ($size[2] == 2)
     $src = imagecreatefromjpeg($file);
    else if ($size[2] == 3)
     $src = imagecreatefrompng($file);
    else
     break;

    $rate = $img_width / $size[0];
    $height = (int)($size[1] * $rate);

    // 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
    if ($height < $img_height)
     // 계산된 이미지 높이로 복사본 이미지 생성
     $dst = imagecreatetruecolor($img_width, $height);
    else
     // 설정된 이미지 높이로 복사본 이미지 생성
     $dst = imagecreatetruecolor($img_width, $img_height);
    imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
    imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
    chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
   }

        }
    }

    if (file_exists($thumb))
        $img = "<img src='$thumb' border=0 style='border:1px solid #CCCCCC; padding:3px;'>";
  elseif(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))
       { $img = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>"; }else{$img="";}
}
?>


   <li <?if($i==0){?>class="view"<?}?>>
   <span>
            <?
            echo $list[$i]['icon_reply'] . " ";
            echo "<a href='{$list[$i]['href']}' title='{$list[$i]['subject']}'>";
            if ($list[$i]['is_notice'])
                echo "<b>{$list[$i]['subject']}</b> {$list[$i]['datetime']}";
            else
                echo "{$list[$i]['subject']} {$list[$i]['datetime']}";
            echo "</a>";
            if ($list[$i]['comment_cnt'])
                echo " <a href=\"{$list[$i]['comment_href']}\">{$list[$i]['comment_cnt']}</a>";
            ?>
   </span>
   </li>

   <? if($i==0){?>
   <div class="content">
    <div>
     <?if(file_exists($thumb)){?><span class="img"><?=$img?></span><?}?>
     <?=cut_str(strip_tags($list[$i]['wr_content']),120)?>
    </div>
    <div class="clear"></div>
   </div>
   <?}?>

  <? } ?>
  <? if (count($list) == 0) { ?>
   <li>게시물이 없습니다.</li>
  <? } ?>
  </ul>
 </div>
-------------
감사합니다

  • 복사

댓글 전체

보드 스킨의 write_update.skin.php 파일에 아래 코드를 넣으면 될 것 같습니다.


$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb_egglatest';
@unlink("$thumb_path/$wr_id"); //썸네일 파일명
basic 스킨을 사용하는데요 write_update.skin.php없어서 다른데것 가져다 해보았는데 안되네요..

하지만 곱슬최님 스킨으로 했더니 되네요..

감사합니다
© SIRSOFT
현재 페이지 제일 처음으로