에디터로 삽입한 이미지 최신글출력 도와주세요.. > 그누4 질문답변

그누4 질문답변

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

에디터로 삽입한 이미지 최신글출력 도와주세요.. 정보

에디터로 삽입한 이미지 최신글출력 도와주세요..

본문

게시판은 배추님 스킨입니다. 최신글 스킨은 다른분이 만드신거구요,,
에디터로 이미지를 삽입할시에 최신글 썸네일을 못불러오네요,,

썸네일 부분 아래와같습니다.

<?

$title = cut_str($list[$i][subject], 34, '..');//본문 글 줄이는 함수
//썸네일 생성
$thumfile = "";
    $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/cheditor4/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // data/geditor------
    $file = './' . $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))
        $thumfile = "<a href='{$list[$i][href]}'><img src='$thumb' width='{$img_width}' height='{$img_height}' border='0' style='border:0 #eee solid' onmouseover=this.style.filter='alpha(opacity=80)' onmouseout=this.style.filter=''></a>";
  else
  //이미지가 없으면
  $thumfile="<a href='{$list[$i][href]}'><img src='$latest_skin_path/img/noimg.gif' width='{$img_width}' height='{$img_height}' style='border:0 #E7E7E7 solid'></a>";
  //이미지가 아니네
        if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))
       { $thumfile = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>"; }
?>


어떻게 해야 출력이 가능한가요?

  • 복사

댓글 전체

© SIRSOFT
현재 페이지 제일 처음으로