아래 소스에서 사진이 없으면 사진없음을 뛰우고 싶습니다.. > 그누4 질문답변

그누4 질문답변

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

아래 소스에서 사진이 없으면 사진없음을 뛰우고 싶습니다.. 정보

아래 소스에서 사진이 없으면 사진없음을 뛰우고 싶습니다..

본문

아래 소스에서 사진이 없으면 사진없음을 뛰우고 싶습니다..

어디어 어떤 코드를 넣어야 하는지요???


<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

if(!$options) $options=3;

$cols  = $options; //  이미지 가로갯수 //  이미지 세로 갯수는 메인에서 지정(총 이미지 수)
$image_h  = 5; // 이미지 상하 간격

$col_width = (int)(99 / $cols);

$data_path = $g4[path]."/data/file/";
$thumb_path = $data_path;
?>

<link rel="stylesheet" href="<?=$latest_skin_path?>/style.css" type="text/css" />


<table width=792 border=0 align="center" cellpadding=0 cellspacing=0>
  <tr>
    <td width="5" height="5"></td>
    <td></td>
    <td width="5" height="5"></td>
  </tr>
  <tr>
    <td></td>
    <td valign="top" ><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td valign="top" style="padding-bottom:2px"><table width="100%" height="25" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td></td>
                <td width="47" align="right"></td>
              </tr>
            </table></td>
        </tr>
        <tr>
          <td valign="top">
 
  <table width=100% border=0 align="center" cellpadding=0 cellspacing=0>
              <tr>
                <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">

<!-- 이미지보이는 부분 시작 -->
<table align="center" cellpadding="0" cellspacing="0" width="100%" border="0">

<tr><td align='center'>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td height='2'></td></tr>
<tr>
<td align='center'>
<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>"; }
$bo_table=$board_list[$i][bo_table];

?>

<td width="<?=$col_width?>%" align="center" valign='top'>
                                           

                                           

<?
  $image = urlencode($list[$i][file][0][file]); //원본
$img=$data_path."/".$bo_table."/".$image;    //썸네일이 없을경우 원본출력
$thumb = $thumb_path."/".$bo_table."/thumb".$list[$i][wr_id];

  if ( file_exists($thumb) )
$img = $thumb;
 
$style = "style='font-family:돋움; font-size:9pt; color:#686695;' ";
if ($list[$i][icon_new]) {
$style = "style='font-family:돋움; font-size:9pt; color:#134980;' "; }
  $subject = "<span $style>".$list[$i][subject]."</span>"; //제목 글자수 자르기
$wr_hit  = $list[$i]['wr_hit'];
$wr_id  = $list[$i]['wr_id'];


//    if ($list[$i]['comment_cnt']) //코
//        $cmt = "({$list[$i]['comment_cnt']})";

$bg = "";  //새글?
if ($list[$i][icon_new])
$bg="la_top_2.gif";
else
$bg="la_top_1.gif";

echo $list[$i][icon_reply] . " ";

echo "<table cellpadding='0' cellspacing='0' border='0'>";
echo " <tr><td background='{$latest_skin_path}/img/la_bg.gif' valign='top' align='center'>
<a href=\"$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id=$wr_id\" onFocus=\"this.blur();\" title=\"{$list[$i][subject]}\">
<img src='{$img}' width='150' height='175' border=0' style='border:0 solid #B2BAEE'>
</a></td></tr>";
echo " <tr><td height='16' align='center'><b>{$subject}</b></td></tr>";
echo " <tr><td height='16' align='center'>{$btimg_dc}</td></tr>";
echo "</table>";
?>
</td>
<? } ?>
<?
$cnt = ($i%$cols);
for ($k=$cnt; $k<$cols && $cnt; $k++) {
echo "<td width=$col_width%>&nbsp;</td>";
}
?>
  <? if ($i+1 < count($list)) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; } ?>
  <? if (count($list) == 0) { echo "<td height=80 align=center>게시물이 없습니다.</td>"; } ?>
  </tr>
</table>
</td>
</tr>
</table>
</td></tr>
</table>
<!-- 이미지보이는 부분 끝 -->
               
                </td>
              </tr>
            </table></td>
        </tr>
      </table></td>
    <td></td>
  </tr>
  <tr>
    <td width="5" height="5"></td>
    <td></td>
    <td width="5" height="5"></td>
  </tr>
</table>
  • 복사

댓글 전체

<?
$image = urlencode($list[$i][file][0][file]); //원본
$img=$data_path."/".$bo_table."/".$image;    //썸네일이 없을경우 원본출력
$thumb = $thumb_path."/".$bo_table."/thumb".$list[$i][wr_id];

  if ( file_exists($thumb) )
$img = $thumb;
---------------------------------------------
이미지를 추출하는 부분은 윗부분이고
출력하는 부분은
echo " <tr><td background='{$latest_skin_path}/img/la_bg.gif' valign='top' align='center'>
<a href=\"$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id=$wr_id\" onFocus=\"this.blur();\" title=\"{$list[$i][subject]}\">
<img src='{$img}' width='150' height='175' border=0' style='border:0 solid #B2BAEE'>
</a></td></tr>";
이 부분이네요.

이미지 없음을 어떻게 표현하려 하시는지 모르겠지만...
이미지 없음 이미지로 표현하신다면 noimg.gif 같은 식으로 표시하고자하는 이미지를 하나 만드시고
(위 코드를 보면 사이즈를 가로 150픽셀, 세로 175픽셀로 만들면 되겠네요.)
그 이미지를 불러오면 되겠네요.
이미지 파일을 ftp 경로 $g4[path]/img/noimg.gif 이렇게 저장하셨다면,

------------------------------------
<?
$image = urlencode($list[$i][file][0][file]); //원본
$img=$data_path."/".$bo_table."/".$image;    //썸네일이 없을경우 원본출력
$thumb = $thumb_path."/".$bo_table."/thumb".$list[$i][wr_id];

  if ( file_exists($thumb) )
$img = $thumb;
------------------------------------
이 소스 다음에
if ($img == "") $img = "{$g4[path]}/img/noimg.gif"; // $img 로 받은 경로가 없을경우 noimg로 대체

추가하면 되지않을까요.
<?
  $image = urlencode($list[$i][file][0][file]); //원본
$img=$data_path."/".$bo_table."/".$image;    //썸네일이 없을경우 원본출력
$thumb = $thumb_path."/".$bo_table."/thumb".$list[$i][wr_id];

  if ( file_exists($thumb) )

$img = $thumb;
   
if ($img == "") $img = "http://idanbi.kr/images/common/sfoot_menu1.gif"; // $img 로 받은 경로가 없을경우 noimg로 대체

$style = "style='font-family:돋움; font-size:9pt; color:#686695;' ";
if ($list[$i][icon_new]) {
$style = "style='font-family:돋움; font-size:9pt; color:#134980;' "; }
  $subject = "<span $style>".$list[$i][subject]."</span>"; //제목 글자수 자르기
$wr_hit  = $list[$i]['wr_hit'];
$wr_id  = $list[$i]['wr_id'];


//    if ($list[$i]['comment_cnt']) //코
//        $cmt = "({$list[$i]['comment_cnt']})";

$bg = "";  //새글?
if ($list[$i][icon_new])
$bg="la_top_2.gif";
else
$bg="la_top_1.gif";

echo $list[$i][icon_reply] . " ";

echo "<table cellpadding='0' cellspacing='0' border='0'>";

echo " <tr><td background='{$latest_skin_path}/img/la_bg.gif' valign='top' align='center'>
<a href=\"$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id=$wr_id\" onFocus=\"this.blur();\" title=\"{$list[$i][subject]}\">
<img src='{$img}' width='150' height='175' border=0' style='border:0 solid #B2BAEE'>
</a></td></tr>";
echo " <tr><td height='16' align='center'><b>{$subject}</b></td></tr>";
echo " <tr><td height='16' align='center'>{$btimg_dc}</td></tr>";
echo "</table>";
?>

추가를 했는데 아무런 반응이 없어요 ㅡㅡ
© SIRSOFT
현재 페이지 제일 처음으로