이미지가 없는 경우 최근글에 엑박대신 노이미지로 보이게 할 수 있을까요?
본문
아래 소스인데요...
이미지가 없을 경우 x자 대신 노이미지가 나오게 하려면 어떻게 해야 할까요?
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$cols = 5; // 이미지 가로갯수 // 이미지 세로 갯수는 메인에서 지정(총 이미지 수)
$imgwidth=130; //표시할 이미지의 가로사이즈
$imgheight=130; //표시할 이미지의 세로사이즈
$image_h = 5; // 이미지 상하 간격
$imgwidth=130; //표시할 이미지의 가로사이즈
$imgheight=130; //표시할 이미지의 세로사이즈
$image_h = 5; // 이미지 상하 간격
$col_width = (int)(100 / $cols);
$data_path = $g4[path]."/data/file/$bo_table";
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<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">
<?
$image = $list[$i][file][0][file]; //원본
$img=$data_path. "/".$image; //썸네일이 없을경우 원본출력
echo $list[$i][icon_reply] . " ";
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
echo "<tr><td valign='top' align='center'><a href='{$list[$i]['href']}'><img src='$img' width='{$imgwidth}' height='{$imgheight}' align='center' style='width:{$imgwidth}px;height:{$imgheight}px;border:0px solid #CECECE; padding:0px'></a></td></tr>";
echo "<tr><td align='center' height='5'></td></tr>";
echo "<tr><td align='center' height='17'><a href='{$list[$i]['href']}'><span style='font-size:9pt;'><b>{$list[$i]['subject']}</b></span></a></td></tr>";
echo "</table>";
?>
</td>
<? } ?>
<?
$cnt = ($i%$cols);
for ($k=$cnt; $k<$cols && $cnt; $k++) {
echo "<td width=$col_width%></td>";
}
?>
<? if (count($list) == 0) { echo "<td align=center>게시물이 없습니다.</td>"; } ?>
</tr>
</table>
</td>
</tr>
</table>
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<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">
<?
$image = $list[$i][file][0][file]; //원본
$img=$data_path. "/".$image; //썸네일이 없을경우 원본출력
echo $list[$i][icon_reply] . " ";
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
echo "<tr><td valign='top' align='center'><a href='{$list[$i]['href']}'><img src='$img' width='{$imgwidth}' height='{$imgheight}' align='center' style='width:{$imgwidth}px;height:{$imgheight}px;border:0px solid #CECECE; padding:0px'></a></td></tr>";
echo "<tr><td align='center' height='5'></td></tr>";
echo "<tr><td align='center' height='17'><a href='{$list[$i]['href']}'><span style='font-size:9pt;'><b>{$list[$i]['subject']}</b></span></a></td></tr>";
echo "</table>";
?>
</td>
<? } ?>
<?
$cnt = ($i%$cols);
for ($k=$cnt; $k<$cols && $cnt; $k++) {
echo "<td width=$col_width%></td>";
}
?>
<? if (count($list) == 0) { echo "<td align=center>게시물이 없습니다.</td>"; } ?>
</tr>
</table>
</td>
</tr>
</table>
답변을 작성하시기 전에 로그인 해주세요.