갤러리 게시판에 이미지가 없을 경우 noimg.gif 출력 정보
갤러리 게시판에 이미지가 없을 경우 noimg.gif 출력관련링크
본문
CSS와 DIV를 이용해서 게시판 스킨을 만들고 있는데요.
갤러리에서 문제가 발생하네요.
다름이 아니라 첨부된 이미지 파일이 없을 때 noimg.gif를 띄우게 되어 있는데, 뜨질 않네요.
어떤 부분이 잘못 됐는지 조언 부탁드려요~ (>.<)
문제가 나타나는 게시판은
이미지가 없을 경우엔 그냥 noimg.gif가 뜨는 게 아니라 제목이 차지해버리네요;;
list.skin.php에는 다음과 같은 코드가 삽입되어 있습니다.
<!-- 썸네일 이미지 시작 -->
<?
$img = "<img src='$board_skin_path/img/noimg.gif' class='listThumb' alt='이미지 없음' />";
//$thumb = $thumb_path.'/'.$list[$i][wr_id];
$thumb = $thumb_path.'/'.$list[$i][file][0][file];
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 = $thumb_width / $size[0];
$height = (int)($size[1] * $rate);
<?
$img = "<img src='$board_skin_path/img/noimg.gif' class='listThumb' alt='이미지 없음' />";
//$thumb = $thumb_path.'/'.$list[$i][wr_id];
$thumb = $thumb_path.'/'.$list[$i][file][0][file];
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 = $thumb_width / $size[0];
$height = (int)($size[1] * $rate);
if ($height < $thumb_height)
$dst = imagecreatetruecolor($thumb_width, $height);
else
$dst = imagecreatetruecolor($thumb_width, $thumb_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $thumb_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][file][0][file], $thumb_quality);
chmod($thumb_path.'/'.$list[$i][file][0][file], 0606);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $thumb_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
$dst = imagecreatetruecolor($thumb_width, $height);
else
$dst = imagecreatetruecolor($thumb_width, $thumb_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $thumb_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][file][0][file], $thumb_quality);
chmod($thumb_path.'/'.$list[$i][file][0][file], 0606);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $thumb_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb) && $list[$i][file][0][file]) {
echo "<a href='{$list[$i][href]}'><img src='{$thumb}' class='listThumb' alt='{$list[$i][subject]}' /></a>";
} else {
preg_match("`<\s*img\s+src\s*=\s*['|\"]?([^'|\"\s]+://[^'|\"\s]+\.(gif|jpe?g|png))['|\"]?\s*[^>]+`i", $list[$i]['wr_content'], $images);
echo "<a href='{$list[$i][href]}'><img src='{$thumb}' class='listThumb' alt='{$list[$i][subject]}' /></a>";
} else {
preg_match("`<\s*img\s+src\s*=\s*['|\"]?([^'|\"\s]+://[^'|\"\s]+\.(gif|jpe?g|png))['|\"]?\s*[^>]+`i", $list[$i]['wr_content'], $images);
if (!empty($images[1])) {
$img_size = GetImageSize("$images[1]");
if($img_size[0] >= $img_size[1]) {
$imgper = $thumb_width/$img_size[0];
$thumb_height = $img_size[1]*$imgper;
}else{
$imgper = $thumb_height/$img_size[1];
$thumb_width = $img_size[0]*$imgper;
}
$img_size = GetImageSize("$images[1]");
if($img_size[0] >= $img_size[1]) {
$imgper = $thumb_width/$img_size[0];
$thumb_height = $img_size[1]*$imgper;
}else{
$imgper = $thumb_height/$img_size[1];
$thumb_width = $img_size[0]*$imgper;
}
echo "<a href='{$list[$i][href]}'><img src='{$images[1]}' width='{$thumb_width}' height='{$thumb_height}' alt='{$list[$i][subject]}' /></a>";
} else {
echo "";
}
}
?><!-- 썸네일 이미지 끝 -->
} else {
echo "";
}
}
?><!-- 썸네일 이미지 끝 -->
댓글 전체
밑에서 네번째 라인에
echo "";
이걸
echo $img;
이렇게 바꿔보세요~
echo "";
이걸
echo $img;
이렇게 바꿔보세요~
이렇게 간단할 줄이야;; (>.<)/
답변 감사드려요~! ^^
답변 감사드려요~! ^^