인

최신글에서 텍스트 대신 이미지 나오게 하는방법?

게시판 글에서 이미지가 없을때 최신글에 텍스트가 No Image라고 뜹니다. 이것을 특정한 이미지가 출력되게 하려면 어떻게 해야 되는지요?
http://mebignara.ivyro.net/bbs/group.php?gr_id=z5 참고 홈페이지의 자유게시판을 보세요..^^

<!-- 게시판 목록 시작 -->
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$img_width = 100;
$img_height = 90;
$img_quality = 95;
$content_cut = 80;
$line_height = 18;

if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");

$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb_ch';
$ym = date("ym", $g4[server_time]);

@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
?>

<style>
<!--
/* 전체 설정 */
#list_all{ width: <? if($width <=100) echo $width.'%'; else echo $width.'px';?>; position: relative; text-align: left; color: #999999; padding: 10px; }
#list_all a { color: #7a7a7a; font-weight: bold; text-decoration: none; }
#list_all dl { margin: 0; }
#list_all dt { margin: 0; padding-bottom: 3px; font-weight: bold; text-align: left; color:#888888; }
#list_all dd { margin: 0; line-height: <?=$line_height?>px; }

/* 페이지 */
#list_page{ height: 25px; text-align:center; vertical-align: middle; margin:5px; padding:5px; }
/* 왼쪽이미지 */
.list_img_0 { width: <?=$img_width?>px; height: <?=$img_height?>px; position: absolute; left: 5px; }
.list_img_0 img { display: inline; border: 0; vertical-align: middle; border:1px solid #646464; }
/* 오른쪽이미지 */
.list_img_1 { width: <?=$img_width?>px; height: <?=$img_height?>px; position: absolute; right: 5px; }
.list_img_1 img { display: inline; border: 0; vertical-align: middle; border:1px solid #646464; }
/* 왼쪽내용 */
.list_content_0 { position: relative; height: <?=$img_height+2?>px; padding-left: <?=$img_width+15?>px; }
/* 오른쪽내용 */
.list_content_1 { position: relative; height: <?=$img_height+2?>px; padding-right: <?=$img_width+15?>px; }
/* 작성정보 */
.list_info { position: absolute; bottom:-3px; margin: 0; text-align: left; color:#999999; }
/* 구분선 */
.list_hr { margin: 8px 0 8px 0; height:1px; line-height:1px; font-size:1px; background-color:#eee; }
-->
</style>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="35"><img src="<?=$latest_skin_path?>/images/box3_03.gif" width="35" height="12" /></td>
<td colspan="3" background="<?=$latest_skin_path?>/images/box3_04.gif"></td>
<td width="26"><img src="<?=$latest_skin_path?>/images/box3_06.gif" width="26" height="12" /></td>
</tr>
<tr>
<td><img src="<?=$latest_skin_path?>/images/box3_08.gif" width="35" height="48" /></td>
<td background="<?=$latest_skin_path?>/images/box3_09.gif" width="40%"><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><font color="#0066CC" ><b><?=$board[bo_subject]?></b></font></a></td>
<td width="32" background="<?=$latest_skin_path?>/images/box_bg_2.gif"><img src="<?=$latest_skin_path?>/images/box3_10.gif" width="47" height="48" /></td>
<td background="<?=$latest_skin_path?>/images/box_bg_2.gif"align="right" valign="bottom"><span style="font-size: 11px; color: #646464; font-family:dotum; letter-spacing:-1;"> </span></td>
<td background="<?=$latest_skin_path?>/images/box_bg_2.gif"><img src="<?=$latest_skin_path?>/images/box3_13.gif" width="26" height="48" /></td>
</tr>
<tr>
<td background="<?=$latest_skin_path?>/images/box3_14.gif"> </td>
<td colspan="3">
<!-- 전체 div 시작 -->
<div id="list_all">


<!-- 게시판 목록 시작 -->
<form name="fboardlist" method="post" style="margin:0;">
<input type='hidden' name='bo_table' value='<?=$bo_table?>'>
<input type='hidden' name='sfl' value='<?=$sfl?>'>
<input type='hidden' name='stx' value='<?=$stx?>'>
<input type='hidden' name='spt' value='<?=$spt?>'>
<input type='hidden' name='page' value='<?=$page?>'>
<input type='hidden' name='sw' value=''>
<div class="list_hr"></div>

<!------------------------------------------ 반복시작 ------------------------------------------>
<? for ($i=0; $i<count($list); $i++) :
//썸네일 생성
$thumfile = "";
$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
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($thumb))
$thumfile = "<img src='$thumb' width='$img_width' height='$img_height'>";
else
//이미지가 없으면
$thumfile="<div style=\"width: {$img_width}; height: {$img_height}; text-align:center; vertical-align:middle; margin-left: 1px; border: 1px solid #666666;\"><br /><br />No Image</div>";
//이미지가 아니네
if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))
{ $thumfile = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>"; }
//번호표시
if ($list[$i][is_notice]) // 공지사항
$list_num = "<img src=\"$board_skin_path/img/icon_notice.gif\">";
else if ($wr_id == $list[$i][wr_id]) // 현재위치
$list_num = "{$list[$i][num]}";
else if ($list[$i][reply]) // 답글
$list_num = $list[$i][reply]. $list[$i][icon_reply];
else
$list_num = "<span style='font:normal 11px tahoma; color:#777777;'>{$list[$i][num]}</span>";
//카데고리
if ($is_category && $list[$i][ca_name])
$list_caname = "[<a href='{$list[$i][ca_name_href]}' style=color: '#cccccc;'>{$list[$i][ca_name]}</a>]";
//제목
$style = "";
if ($list[$i][is_notice]) $style = " style='font-weight:bold;'";
$list_i_href = "<a href='{$list[$i][href]}' $style>".$list[$i][subject]."</a>";
//코멘트수
if ($list[$i][comment_cnt])
$list_comment = "<a href=\{$list[$i][comment_href]}\><span style='font-family:Tahoma;font-size:10px;color:#EE5A00;'>{$list[$i][comment_cnt]}</span></a>";
//아이콘
$list_icon = $list[$i][icon_new] . $list[$i][icon_link] . $list[$i][icon_hot] . $list[$i][icon_secret];
//내용
$list_content = cut_str(strip_tags($list[$i][wr_content]),$content_cut);
//좌냐 우냐
$l_r = $i%1; //////$l_r = $i%2; 좌/우
?>

<!-- 출력 시작 -->
<div class="list_content_<?=$l_r?>">
<div class="list_img_<?=$l_r?>"> <!-- 사진 출력 -->
<a href='<?=$list[$i][href]?>'><?=$thumfile?></a>
</div>
<!-- 내용 -->
<dl>
<dt>
<nobr style='display:block; overflow:hidden;'>
<?=$list_num?> <?=$list_checkbox?><?=$list_caname?> <?=$list_i_href?><?=$list_comment?> <?=$list_icon?>
</nobr>
</dt>
<dd><?=$list_content?></dd>

</dl>
</div>
<!-- 내용 끝-->
<div class="list_hr"> </div>
<!-- 출력 끝 -->

<?
$list_comment = Null;
flush();
endfor;
if (count($list) == 0) { echo "<span style='width:100%; text-align: center;'>게시물이 없습니다.</span>"; }
?>
<!------------------------------------------ 반복끝 ------------------------------------------>
</form>



</div>
<!-- 전체 div 끝 -->


</td>
<td background="<?=$latest_skin_path?>/images/box3_16.gif"> </td>
</tr>
<tr>
<td><img src="<?=$latest_skin_path?>/images/box3_19.gif" width="35" height="27" /></td>
<td colspan="3" background="<?=$latest_skin_path?>/images/box3_21.gif"> </td>
<td><img src="<?=$latest_skin_path?>/images/box3_23.gif" width="26" height="27" /></td>
</tr>
</table>


<script language="JavaScript">
if ('<?=$sca?>') document.fcategory.sca.value = '<?=$sca?>';
if ('<?=$stx?>') {
document.fsearch.sfl.value = '<?=$sfl?>';
}
</script>


<!-- 게시판 목록 끝 -->

댓글 1개

//이미지가 없으면
$thumfile="<div style=\"width: {$img_width}; height: {$img_height}; text-align:center; vertical-align:middle; margin-left: 1px; border: 1px solid #666666;\"><br /><br />No Image</div>";


부분을

//이미지가 없으면
$thumfile="<img src='/noimg경로/noimg파일명.gif' width='$img_width' height='$img_height'>";
댓글을 작성하시려면 로그인이 필요합니다.

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

+
제목 글쓴이 날짜 조회
10-05-11 조회 1,622
10-05-11 조회 1,621
10-05-11 조회 1,620
10-05-11 조회 1,603
10-05-11 조회 1,617
10-05-11 조회 1,630
10-05-11 조회 1,676
10-05-11 조회 1,612
10-05-11 조회 1,513
10-05-11 조회 1,635
10-05-11 조회 1,284
10-05-11 조회 1,723
10-05-11 조회 1,672
10-05-11 조회 2,344
10-05-10 조회 1,480
10-05-10 조회 1,327
10-05-10 조회 1,403
10-05-10 조회 2,012
10-05-10 조회 1,615
10-05-10 조회 1,341