이미지 최신글 쎔네일 경로문제좀!!! > 그누4 질문답변

그누4 질문답변

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

이미지 최신글 쎔네일 경로문제좀!!! 정보

이미지 최신글 쎔네일 경로문제좀!!!

첨부파일

cacique3.7z (4.1K) 2회 다운로드 2009-08-02 03:08:20
zgallery.lib.php (1.8K) 3회 다운로드 2009-08-02 03:08:20

본문

최신글 스킨은 아래를 쓰고 있습니다.
http://www.sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=83257
갤러리는 운영자님이 올려주신거 수정해서 쓰고 있었습니다.

이번에 갤러리를 아래껄로 바꾸었습니다.
http://www.sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=92428

최신글 스킨의 썸네일 이미지 경로가 아래 처럼 나왔는데요
data/file/goodface/thumb/번호

이번에 새로 바꾼 리스트에 나오는 그림 썸네일주소는 아래와 같은 식으로 나옵니다.
data/file/goodface/__thum__622012868_JPyimau9_BEC6B8AEB5FBBFEE+B6F3C0CE1.jpg
몇시간째하고 있지만 진전도 없고 뭘 어떻게 해야될지도 모르겠습니다.

어떻게 해야 될까요??? 제발 도와주세요 ㅠㅠ 아
포인트 다 겁니다.!! 도와주세요


댓글 전체

두개의 스킨이 아래와 같은 특성이 있습니다.
현재 latest으로 쓰는 스킨은 이미 만들어져 있는 썸네일을 가져다만 쓰지,  생성하지는 않습니다.
새로바꾼 보드에서는 썸디랙을 생성하지 않고 사진과 함께 파일명앞에 구분자를 주어 저장을 하고 있구요.

썸네일 호출 경로 (/skin/latest/cacique3/latest.skin.php)
$thumb_path = $data_path.'/thumb';
$thumb = $thumb_path.'/'.$list[$i][wr_id];

새로바뀐 사진 저장경로 (스킨/ref/g4_thumb.php)
$thum = $savePath ? $savePath : dirname($img);
$thum .= "/__thum__".basename($img);

방법 1  현재 latest.skin.php에서 썸디랙을 만들고 썸을 생성해서 사용하는 방법
방법 2  새로바뀐 보드에서 만들어진 썸 가져오는 방법

썸네일 사이즈 때문에 방법1로 합니다.
일단 latest.skin.php파일 백업받아놓으시고 아래 긁어서 latest.skin.php 로 넣어주세요....

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

$img_width = 200; //큰 썸네일 가로
$img_height = 130; //큰 썸네일 세로
$img_quality = 90; //썸네일 퀄리티

if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");

$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb';
$ym = date("ym", $g4[server_time]);

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


<?
//썸네일 생성
$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/geditor/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // geditor 사용할 경우주석풀어서 사용
//     if (eregi("data/cheditor/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // chedito 사용할 경우주석풀어서 사용
if (eregi("data/cheditor4/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // 에디터가 cheditor4 이면 주석풀어서 사용


$file = '../' . $tmp[0]; //  파일경로  필요에 따라 변경하세요    .  or  .. 
$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 = "<img src='$thumb' width='{$img_width}' height='{$img_height}' border='0' style='border:0px #ccc solid'></a>";
else
//이미지가 없으면
$thumfile="<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>"; }

?>

<a href='<?=$list[$i][href]?>'><?=$thumfile?></a>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="1" height="1"></td>
<td height="1" bgcolor="#E1E1E1"></td>
<td width="1" height="1"></td>
</tr>
<tr>
<td width="1" bgcolor="#E1E1E1"></td>
<td>

            <table width="100%" border="0" cellpadding="0" cellspacing="4" bgcolor="#FFFFFF">
                <tr>
                    <td align=center valign="top" bgcolor="FFFFFF" style="padding:0px">
    <table width="97%" border="0" cellspacing="0" cellpadding="0">
    <tr bgcolor=#FFFFFF>
        <td height="22"><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><strong><?=$board[bo_subject]?></strong></a></td>
        <td align="right"><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><span style='font-size:8pt; color:#9A9A9A;'>⇒더보기</span></td>
    </tr>
    <tr><td colspan=2 height="1" bgcolor=EEEEEE></td></tr>
    <tr><td colspan=2 height="3"></td></tr>
    </table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<?
for ($i=0; $i<count($list); $i++)
{
    if ($i && $i%$mod==0)
        echo "</tr><tr>";

    else if ($i > 0)
        echo "<td width=20></td>";

$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb';
    $img = "<img src='$latest_skin_path/img/noimage.gif' border=0 style='background:#FFFFFF; border:1px solid #E1E1E1; padding:2px;'>";
    $thumb = $thumb_path.'/'.$list[$i][wr_id];

    if (file_exists($thumb))
        $img = "<img src='$thumb' width='{$img_w}' border=0 style='background:#FFFFFF; border:1px solid #E1E1E1; padding:2px;'>";

    $href = "$g4[bbs_path]/board.php?bo_table=$bo_table";

    echo <<<HEREDOC
    <td align="center">
        <table border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
            <td align=center width='{$img_w}' height='{$img_h}'><a href='{$list[$i][href]}' onfocus='this.blur()'>{$img}</a></td>
</tr>
<tr>
            <td align=center width='{$img_w}'><a href='{$list[$i][href]}' onfocus='this.blur()'><span style='font-size:8pt;'>{$list[$i][subject]}</span></a></td>
</tr>
</table></td>
HEREDOC;
}
?>
</tr>
</table>

</td></tr>
</table>

</td>
<td width="1" bgcolor="#E1E1E1"></td>
</tr>
<tr>
<td width="1" height="1"></td>
<td height="1" bgcolor="#E1E1E1"></td>
<td width="1" height="1"></td>
</tr>
</table>
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT