한번만더도와주세요. 최근게시물 이미지없을때 대처하는이미지좀.. > 그누4 질문답변

그누4 질문답변

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

한번만더도와주세요. 최근게시물 이미지없을때 대처하는이미지좀.. 정보

한번만더도와주세요. 최근게시물 이미지없을때 대처하는이미지좀..

본문

최근게시물에 이미지가없으면 X박스가 자꾸 뜨네요 ㅠ

초보라서 도데체 어디를 수정해야되는지..좀알려주세요.

저번에도 비슷한질문을 올렸는데 서누니님이 답변해주셨는데..비슷한거같은데 제가 하니까 자꾸오류가 나더라구요. 이미지없을때 대처하는이미지를 불러오는걸 설정하고싶은데..꼭좀도와주세요.

소스는

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

$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb';
?>
<style type="text/css">
<!--
.style1 {
color: #000000;
font-weight: #000000;
}
-->
</style>


<table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><div align="center">
          <table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <? for($i=0; $i<count($list); $i++) {$m++;?>
            <td width="65" valign="top"><div align="center">
                <table width="55" border="0" cellspacing="0">
                  <tr>
                    <td><div align="center">
                        <?
$image = $list[$i][file][0][file]; //원본 리사이즈_아래 자바와 연동_추가
$img=$data_path. "/".$image;  //썸네일이 없을경우 원본출력
$thumb = $thumb_path. "/". $list[$i][wr_id];

  if ( file_exists($thumb) )
$img = $thumb;
 
    $style_a = "font-family:돋움; font-size:8.7pt; color:#000000;";

$style = "font-family:돋움; font-size:8.7pt; color:#000000;";
?> <!--이미지 가로와 세로의 크기를 정해주세요 --> 
 &nbsp;&nbsp;<?
 echo "<a href='{$list[$i][href]}' onfocus='this.blur()'><img src='$img' width='126' height='66' border='0'></a>";

            echo $list[$i]['icon_reply'] . " ";
            echo "<a href='{$list[$i]['href']}'>";
            if ($list[$i]['is_notice'])
                echo "&nbsp;<font style='font-family:돋움; font-size:8.7pt; color:#000000;'><strong>{$list[$i]['subject']}</strong></font>";
            else
                echo "&nbsp;<font style='font-family:돋움; font-size:8.7pt; color:#000000;'>{$list[$i]['subject']}</font>";
            echo "</a>";

 ?><!--사이즈 width='120' 과 height='120'이 기본설정입니다. 자신에 맞게 수정하세요 --> </div></td>
                  </tr>
                  <tr>
                    <td height="2"></td>
                  </tr>
                </table>
            </div></td>
<!--가로이미지 숫자를 정해주세요 -->   
        <? if ($m%5==0){ ?>
<!--가로이미지 숫자와 최신게시물을 부를때 갯수와는 다릅니다. -->
          </tr>
          <tr>
                        <td></td>
            <?}?>
            <? } ?>
            <? if (count($list) == 0) { echo "<td height=30 align=center>이미지가 없습니다.</td>"; } ?>
          </tr>
        </table>
          </div></td>
      </tr>
    </table>

입니다.ㅠ
  • 복사

댓글 전체

if ( file_exists($thumb) )
$img = $thumb; 를 아래와 같이 대체 이미지로 변경하세요.
if (file_exists($img) 
$img = "/skin/latest/basic/img/no_image.jpg"
으로 하시면 되는데, $img의 no_image.jpg 파일이 해당 경로에 있어야 겠죠?
이것도 답이 아니라면 유창화로 최근 글을 검색하시면 또 다른 답이 있습니다.
© SIRSOFT
현재 페이지 제일 처음으로