그룹최신글 썸네일 처리 질문. > 그누4 질문답변

그누4 질문답변

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

그룹최신글 썸네일 처리 질문. 정보

그룹최신글 썸네일 처리 질문.

본문

다음 링크에 있는 팁을 이용하여 그룹 최신글을 뽑았습니다.
 
 
썸네일 생성 스킨
 
 
다음 링크를 보면 확실히 어떠한 증상인지 알 수 있습니다~
 
문제되는 점
1,2
3,4
5,6
으로 배열.
 
1,4 번과 2,6은 게시물의 이미지가 다른데, 동일하게 썸네일이 생성 되었어요~
제목과 링크는 옳바르게 출력된다는 점.
썸네일 이미지만 올바르지 않게 생성되네요.
왜 이렇게 되는지 설명해주시면 복 받으실거에요. ^ ^
 
 
 
=============================
썸네일 생성
 
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb100';
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
$mod = 2; //이미지 가로 갯수
?>
<!-- <?=$board[bo_subject]?> (<?=$board[bo_table]?>) 최신글 -->
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center">
<tr><td align="center">
<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=5> </td>";
    $img = "<img src='$latest_skin_path/img/no_image.gif' border=0 title='이미지 없음'>";
    $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
                continue;
            $rate = 100 / $size[0];
            $height = (int)($size[1] * $rate);
            if ($height < 75)
                $dst = imagecreatetruecolor(100, $height);
            else
                $dst = imagecreatetruecolor(100, 75);
            imagecopyresampled($dst, $src, 0, 0, 0, 0, 100, $height, $size[0], $size[1]);
            imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], 100);
            chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
        }
    }
    if (file_exists($thumb))
        $img = "<img src='$thumb' border=0>";
    $href = "$g4[bbs_path]/board.php?bo_table=$bo_table";
    echo <<<HEREDOC
    <td valign="top" align="center">
        <table border="0" cellpadding="0" cellspacing="0" align="center">
 <tr>
            <td height="5" align="center"></td>
 </tr>
 <tr>
            <td align=center width='100' height='75' style='width:100px;height:75px;border:1px solid #CCCCCC; padding:3px'><div style='width:100px; height:75px; position: relative; overflow:hidden;' align=center><a href='{$list[$i][href]}' onfocus='this.blur()'>{$img}</a></div></td>
 </tr>
 </tr>
 <tr>
            <td height="5" align="center"></td>
 </tr>
 <tr>
            <td width="100" height="20" align="center" class="sub"><a href='{$list[$i][href]}'>{$list[$i][subject]}</a></td>
 </tr>
 <tr>
            <td height="1" background="{$latest_skin_path}/img/line.gif"></td>
 </tr>
 <tr>
            <td height="20" align="center" class="sub"><span style="FONT-SIZE: 8pt;">{$list[$i][wr_datetime]}</span></td>
 </tr>
 </table>
    </td>
HEREDOC;
}
?>
</tr>
</table>
</td></tr>
</table>
  • 복사

댓글 전체

new.php파일을 수정해서 '그룹최근이미지'를 추출하는 방법입니다.
http://www.sir.co.kr/bbs/tb.php/g4_skin/12637
위 링크에서 라이브러리 파일을 참조하세요.
썸네일 생성 경로 및 파일이름은 다릅니다.
© SIRSOFT
현재 페이지 제일 처음으로