이미지가 없을때 noimg.gif 이미지를 출력하게 하는데 엑박뜹니다 정보
이미지가 없을때 noimg.gif 이미지를 출력하게 하는데 엑박뜹니다
본문
http://www.munstar.co.kr/?mw_main=G01
이 부분에 가보시면 게시판에 이미지가 없을때 전부 엑박이 뜨는데,...
게시판이 지정되지 않은 최신글은 엑박이 안뜨네요..
이문제는 어떻게 해결하나요?
아래 코드인데 어떻게 적용해야하나요???
이 부분에 가보시면 게시판에 이미지가 없을때 전부 엑박이 뜨는데,...
게시판이 지정되지 않은 최신글은 엑박이 안뜨네요..
이문제는 어떻게 해결하나요?
아래 코드인데 어떻게 적용해야하나요???
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");
$cols = 5; // 이미지 가로갯수 // 이미지 세로 갯수는 메인에서 지정(총 이미지 수)
$img_width = '130'; //썸네일 가로길이
$img_height = '100'; //썸네일 세로길이
$img_quality = '99'; //퀼리티 100이하로 설정
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb_04'; //썸네일 이미지 생성 디렉토리
$ym = date("ym", $g4[server_time]);
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
$col_width = (int)(98 / $cols);
?>
<!-- 전체 -->
<table width=100% border=0 cellpadding=0 cellspacing=0 >
<tr><td>
<!-- 최신글 제목 -->
<? /* ?>
<table width=95% border=0 cellpadding=0 cellspacing=0 align="center">
<tr height="25">
<td ><img src='<?=$latest_skin_path?>/img/icon_title.gif'>
<a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><font color="#555555" ><b><?=$board[bo_subject]?></b></font></a>
</td>
<td align="right"><span style="font-size: 12px; color: #646464; font-family:dotum; letter-spacing:-1;"><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><img src='<?=$latest_skin_path?>/img/icon_main_more.gif'border="0" ></a></span></td>
</tr>
<tr><td height="2"colspan="2"></td></tr>
<tr><td height="1" colspan="2" bgcolor="#e1e1e1"></td></tr></table>
<? */ ?>
<!-- 최신글 제목 -->
<!-- 내용 -->
<table width="99%" border="0" cellspacing="0" cellpadding="0" style="margin-top:16px;">
<tr>
<? for ($i=0; $i<count($list); $i++) {
if ($i>0 && $i%$cols==0) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; }
?>
<td width="<?=$col_width?>%" align="center" valign='top'>
<?
$img = "";
$img = $thumb_path.'/'.$list[$i][wr_id];
// 썸네일 이미지가 존재하지 않는다면
if (!file_exists($img)) {
$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/cheditor4/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // data/geditor------
$file = './' . $tmp[0]; // 파일명
$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($img)){
$img = "<a href='{$list[$i][href]}'><img src='$img' width='$img_width' height='$img_height' border='0' style='border:1 #eee solid' onmouseover=this.style.filter='alpha(opacity=60)' onmouseout=this.style.filter='' title='{$list[$i][subject]}'></a>";
} else {
//이미지가 없으면
$img="<img src='$latest_skin_path/img/noimg.gif' width='{$img_width}' height='{$img_height}' style='border:1 #E7E7E7 solid'></a>";
//이미지가 아니네
if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file)) $img = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>";
}
?>
댓글 전체

맨 아래
if (file_exists($img))
echo $img . " (1)";
else
echo $img . " (2)";
넣어서 확인 한번 해보세요
if (file_exists($img))
echo $img . " (1)";
else
echo $img . " (2)";
넣어서 확인 한번 해보세요

./data/file/B37/thumb_04/ (1) ./data/file/B37/thumb_04/
게시물이 없어요.
Bedroom:
sq:
price: $0
by
이런식으로 출력되는데요~~
게시물이 없어요.
Bedroom:
sq:
price: $0
by
이런식으로 출력되는데요~~

./data/file/B37/thumb_04/ (1)
소스에 51 라인 입니다.
$img = $thumb_path.'/'.$list[$i][wr_id];
올려주신 결과 처럼 파일명이 없이 경로만 들어가도
파일이 있는것으로 인식이 되네요 이때문에
else
echo $img . " (2)";
에 대한 썸네일이 없는 경우에 결과값이 출력이 안돼고 있습니다.
이 부분을 파악해 보시는게 좋겠습니다.
소스에 51 라인 입니다.
$img = $thumb_path.'/'.$list[$i][wr_id];
올려주신 결과 처럼 파일명이 없이 경로만 들어가도
파일이 있는것으로 인식이 되네요 이때문에
else
echo $img . " (2)";
에 대한 썸네일이 없는 경우에 결과값이 출력이 안돼고 있습니다.
이 부분을 파악해 보시는게 좋겠습니다.

초보라서 어떻게 수정해야할지 감이 안잡히네요..