최신글 스킨..노이미지 나오게좀 도와주세요.!! 정보
최신글 스킨..노이미지 나오게좀 도와주세요.!!본문
최신글 스킨인데요 노이미지 나오게좀 도와주세요.!!!!!
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$la_content = "100"; //내용길이
$img_w = "150"; //썸네일 가로
$img_h = "80"; //썸네일 세로
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb_'.$img_w.'_'.$img_h;
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
?>
<style type="text/css">
#photo_v27_img, #photo_v27_list{float:left}
#photo_v27_img{width:100px;border:1px solid #CCCCCC;padding:3px;}
#photo_v27_list{width:310px;height:100px;padding:0 0 0 5px;}
.photo_v27_sub{height:10px;}
</style>
<?
for ($i=0; $i<count($list); $i++) {
//썸네일 코드 시작
$img = "<div style='width:100px;height:55px;'></div>";
$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 = $img_w / $size[0];
$height = (int)($size[1] * $rate);
if ($height < $img_h)
$dst = imagecreatetruecolor($img_w, $height);
else
$dst = imagecreatetruecolor($img_w, $img_h);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_w, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], 100);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' align='absmiddle' border='0'>";
$href = "{$list[$i][href]}";
$subject = "<span $style>".cut_str($list[$i][subject],1000)."</span>";
$wr_content = "<span $style>".cut_str(strip_tags($list[$i][wr_content]),$la_content)."</span>";
// 출력
echo <<<HEREDOC
<div>
<div id="photo_v27_img"><a href='{$href}' onfocus='this.blur()'>{$img}</a></div>
<div id="photo_v27_list">
<div class="photo_v27_sub"><a href='{$href}'><strong>{$subject}</strong></a></div>
<div><a href='{$href}'>{$wr_content}</a></div>
</div>
</div>
HEREDOC;
}
?>
<? if (count($list) == 0) { ?>
<div style="height:25px;" align="center">게시물이 없습니다.</div>
<? } ?>
댓글 전체
noimage 파일은 적당하게 경로와 파일명을 수정해서 쓰시면 되겠습니다.
============ 수정 전 ===============
if (file_exists($thumb))
$img = "<img src='$thumb' align='absmiddle' border='0'>";
===================================
============ 수정 후 ===============
if (file_exists($thumb)) // 썸네일이 존재할 경우
$img = "<img src='$thumb' align='absmiddle' border='0'>";
else // 썸네일이 존재하지 않을 경우
$img = "<img src='$board_skin_path/img/noimage.gif' align='absmiddle' border='0'>";
===================================