최신글 GD 적용부분에 질문입니다. 정보
최신글 GD 적용부분에 질문입니다.본문
안녕하세요.
최신글에 썸네일 이미지를 좌측에 보이게하고 제목과 내용을 간단하게 보여주는 스킨을 만들어봤습니다.
그런데...현재 업로드되어있는 최신글 썸네일 기능은 문제가 있는듯 합니다.
왠지는 모르겠지만 최신글 latest.skin.php 스킨으로는 썸네일 이미지가 생성되지 않는다는 사실입니다.
답사기 게시판이라면 이미지를 등록하고 리스트를 볼때 썸네일 이미지를 생성하지요?
그리고 나서 최신글을 출력해 보면 손톱 이미지가 만들어져 있으니 정상적으로 출력됩니다.
그러나 이미지를 등록하고나서 리스트 화면을 한번도 출력하지 않은 상태에서 최신글 화면을 보면 손톱이미지가 보이지 않는다는 것입니다.
썸네일 이미지를 생성한다는 스킨 5개정도 다운받아 도전해 봤으나 latest.skin.php 스킨 자체가 썸네일 이미지를 생성하지 못했다는 사실입니다.
같은 리스트 게시판 썸네일 소스를 latest.skin.php에 적용해 봤으나 그것도 안되네요.
손톱이미지 최신글 스킨을 만들어 사용하시는 분중에 테스트 부탁드립니다.
수고하세요.
최신글에 썸네일 이미지를 좌측에 보이게하고 제목과 내용을 간단하게 보여주는 스킨을 만들어봤습니다.
그런데...현재 업로드되어있는 최신글 썸네일 기능은 문제가 있는듯 합니다.
왠지는 모르겠지만 최신글 latest.skin.php 스킨으로는 썸네일 이미지가 생성되지 않는다는 사실입니다.
답사기 게시판이라면 이미지를 등록하고 리스트를 볼때 썸네일 이미지를 생성하지요?
그리고 나서 최신글을 출력해 보면 손톱 이미지가 만들어져 있으니 정상적으로 출력됩니다.
그러나 이미지를 등록하고나서 리스트 화면을 한번도 출력하지 않은 상태에서 최신글 화면을 보면 손톱이미지가 보이지 않는다는 것입니다.
썸네일 이미지를 생성한다는 스킨 5개정도 다운받아 도전해 봤으나 latest.skin.php 스킨 자체가 썸네일 이미지를 생성하지 못했다는 사실입니다.
같은 리스트 게시판 썸네일 소스를 latest.skin.php에 적용해 봤으나 그것도 안되네요.
손톱이미지 최신글 스킨을 만들어 사용하시는 분중에 테스트 부탁드립니다.
수고하세요.
댓글 전체

저는 잘 되는데요....^^
썸네일 생성하는 부분만 따로 떼어 내어서 실행해 보세요.
무슨 에러 메시지가 나올 텐데요.
그 내용을 보면 확실해 지겠죠.
무슨 에러 메시지가 나올 텐데요.
그 내용을 보면 확실해 지겠죠.
http://sir.co.kr/bbs/tb.php/g4_skin/9707
g4용이지만,
변수 두어개를 제외하고는 gnu3.xx와 대동소이할겁니다.
응용해 보시기 바랍니다.
질문내용을 보아하니,
리스트 스킨에서 썸네일을 생성하는 루틴이 포함되어 있는듯 하군요.
g4용이지만,
변수 두어개를 제외하고는 gnu3.xx와 대동소이할겁니다.
응용해 보시기 바랍니다.
질문내용을 보아하니,
리스트 스킨에서 썸네일을 생성하는 루틴이 포함되어 있는듯 하군요.
답변 감사드립니다. 아직도 어디가 잘못인지 못찾았습니다.
그누3 버전으로 차근차근 변조(?) 해보니까 잘되네요.
몇일 이것저것 테스트하면서 공부한 결과네요..ㅋ
나름대로 소스 참고하여 변경한 lastest.skin.php 내용입니다.
<?
$max =80; // 쎔네일 이미지 사이즈
$resol = 80; // 쎔네일 이미지 해상도
$len = 10; // 제목의 길이
?>
<table width=100% cellpadding=0 cellspacing=0 align=center border=0>
<tr>
<?
for ($i=0; $i<count($list); $i++) {
$file = $list[$i][file_image1];
$thum = $file.".Thum" ;
$size = getimagesize($file);
if (!file_exists($thum))
{
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file))
{
// 가로:세로 비율 맞추기
if ( $size[0] > $size[1] ) { //가로형일 경우.
$thum_W = $max ;
$thum_H = ceil( $size[1] * ( $max / $size[0] ) );
}
if ( $size[0] < $size[1] ) { //세로형일 경우.
$thum_H = $max ;
$thum_W = ceil( $size[0] * ( $max / $size[1] ) );
}
if ( $size[0] == $size[1] ) { //정사각형일 경우.
$thum_W = ceil( $max * 0.8 );
$thum_H = ceil( $max * 0.8 );
}
if ($size[2] == 1)
$origImg = imagecreatefromgif($file);
else if ($size[2] == 2)
$origImg = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$origImg = imagecreatefrompng($file);
else
break;
$newImg = ImageCreateTrueColor($thum_W, $thum_H); // GD라이브러리 2.0 전용함수
imageCopyResampled($newImg, $origImg, 0, 0, 0, 0, $thum_W, $thum_H, ImageSX($origImg), ImageSY($origImg));
Imagejpeg($newImg, $thum, $resol );
chmod($thum,0606);
ImageDestroy($newImg);
ImageDestroy($origImg);
}
}
else {
$size = getimagesize($thum);
$thum_W = $size[0];
$thum_H = $size[1];
}
?>
<td valign=top>
<table bgcolor=#ffffff cellpadding=0 cellspacing=0 border=0>
<tr height=92>
<td width=92 align=center valign=middle bgcolor=#F2F4F4 style='padding:5;'>
<a href='<?=$list[$i][href]?>' onfocus=blur()><img src='<?=$thum?>' width='<?=$thum_W?>' height='<?=$thum_H?>' alt='<?=$list[$i][wr_subject]?>' style='border-color:#A5A5A5;' border=1 ></a><br><br>
</td>
<td width=8 background='<?=$latest_skin?>/sdw_R.gif' ></td>
</tr>
<tr height=20>
<td align=center valign=middle bgcolor=#F2F4F4>
<? if ($is_checkdelete) { ?><input type=checkbox name=chk_wr_id[] value='<?=$list[$i][wr_id]?>'><? } ?> <a href='<?=$list[$i][href]?>'><? if ($list[$i][is_notice]) echo "<b>"; ?><?=cut_str($list[$i][subject], $len)?><? if ($list[$i][is_notice]) echo "</b>"; ?></a> <?=$list[$i][icon_new]?>
<span style='font-size:8pt;'><?=$list[$i][commentcnt]?></span>
</td>
<td width=8 background='<?=$latest_skin?>/sdw_R.gif' ></td>
</tr>
<tr height=8>
<td background='<?=$latest_skin?>/sdw_B.gif' ></td>
<td background='<?=$latest_skin?>/sdw_RB.gif' ></td>
<td width=3 rowspan="3">
</tr>
</table>
</td>
<?}?>
<? if (count($list) == 0) { echo "<td align=center height=50>그림 없음.</td>"; } ?>
</tr>
</table>
그누3 버전으로 차근차근 변조(?) 해보니까 잘되네요.
몇일 이것저것 테스트하면서 공부한 결과네요..ㅋ
나름대로 소스 참고하여 변경한 lastest.skin.php 내용입니다.
<?
$max =80; // 쎔네일 이미지 사이즈
$resol = 80; // 쎔네일 이미지 해상도
$len = 10; // 제목의 길이
?>
<table width=100% cellpadding=0 cellspacing=0 align=center border=0>
<tr>
<?
for ($i=0; $i<count($list); $i++) {
$file = $list[$i][file_image1];
$thum = $file.".Thum" ;
$size = getimagesize($file);
if (!file_exists($thum))
{
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file))
{
// 가로:세로 비율 맞추기
if ( $size[0] > $size[1] ) { //가로형일 경우.
$thum_W = $max ;
$thum_H = ceil( $size[1] * ( $max / $size[0] ) );
}
if ( $size[0] < $size[1] ) { //세로형일 경우.
$thum_H = $max ;
$thum_W = ceil( $size[0] * ( $max / $size[1] ) );
}
if ( $size[0] == $size[1] ) { //정사각형일 경우.
$thum_W = ceil( $max * 0.8 );
$thum_H = ceil( $max * 0.8 );
}
if ($size[2] == 1)
$origImg = imagecreatefromgif($file);
else if ($size[2] == 2)
$origImg = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$origImg = imagecreatefrompng($file);
else
break;
$newImg = ImageCreateTrueColor($thum_W, $thum_H); // GD라이브러리 2.0 전용함수
imageCopyResampled($newImg, $origImg, 0, 0, 0, 0, $thum_W, $thum_H, ImageSX($origImg), ImageSY($origImg));
Imagejpeg($newImg, $thum, $resol );
chmod($thum,0606);
ImageDestroy($newImg);
ImageDestroy($origImg);
}
}
else {
$size = getimagesize($thum);
$thum_W = $size[0];
$thum_H = $size[1];
}
?>
<td valign=top>
<table bgcolor=#ffffff cellpadding=0 cellspacing=0 border=0>
<tr height=92>
<td width=92 align=center valign=middle bgcolor=#F2F4F4 style='padding:5;'>
<a href='<?=$list[$i][href]?>' onfocus=blur()><img src='<?=$thum?>' width='<?=$thum_W?>' height='<?=$thum_H?>' alt='<?=$list[$i][wr_subject]?>' style='border-color:#A5A5A5;' border=1 ></a><br><br>
</td>
<td width=8 background='<?=$latest_skin?>/sdw_R.gif' ></td>
</tr>
<tr height=20>
<td align=center valign=middle bgcolor=#F2F4F4>
<? if ($is_checkdelete) { ?><input type=checkbox name=chk_wr_id[] value='<?=$list[$i][wr_id]?>'><? } ?> <a href='<?=$list[$i][href]?>'><? if ($list[$i][is_notice]) echo "<b>"; ?><?=cut_str($list[$i][subject], $len)?><? if ($list[$i][is_notice]) echo "</b>"; ?></a> <?=$list[$i][icon_new]?>
<span style='font-size:8pt;'><?=$list[$i][commentcnt]?></span>
</td>
<td width=8 background='<?=$latest_skin?>/sdw_R.gif' ></td>
</tr>
<tr height=8>
<td background='<?=$latest_skin?>/sdw_B.gif' ></td>
<td background='<?=$latest_skin?>/sdw_RB.gif' ></td>
<td width=3 rowspan="3">
</tr>
</table>
</td>
<?}?>
<? if (count($list) == 0) { echo "<td align=center height=50>그림 없음.</td>"; } ?>
</tr>
</table>