최근 갤러리에서 엑박 방지법은? > 그누4 질문답변

그누4 질문답변

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

최근 갤러리에서 엑박 방지법은? 정보

최근 갤러리에서 엑박 방지법은?

본문

토탈나라님의 멋진 갤러리 최근게시물 스킨을 적용했습니다
근데 그림을 직접 올리지 않고 링크를 거신 몇몇 분이 계셔서 흉하게 엑박이 뜨네요..
이미지가 없을 때 대신 보여주는 그림파일 적용법을 알고 싶습니다.
다음은 latest.skin.php입니다


<?
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: bold;
}
-->
</style>


<table width='100%' cellpadding='0' cellspacing='0' border='0'>
  <tr>
    <td width='5' height='5'><img src='<?=$latest_skin_path?

>/img/1.gif' width='5' height='5' border='0'></td>
    <td background='<?=$latest_skin_path?>/img/2.gif'></td>
    <td width='5'><img src='<?=$latest_skin_path?>/img/3.gif'

width='5' height='5' border='0'></td>
  </tr>
  <tr>
    <td background='<?=$latest_skin_path?>/img/4.gif'></td>
    <td align='center' valign='top' bgcolor='#FFFFFF'><table

width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table width="100%"  border="0" cellspacing="0"

cellpadding="0">
          <tr>
            <td>&nbsp;&nbsp;<font color="#003366"><strong>
              <?=$board[bo_subject]?>
            </strong></font></td>
            <td><div align="right"><a href='<?=$g4[bbs_path]?

>/board.php?bo_table=<?=$bo_table?>'><img src="<?=$latest_skin_path?

>/img/more.gif" width="32" height="9" border="0"></a></div></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td height="1" bgcolor="#2d8cda"></td>
      </tr>
      <tr>
        <td height="2"></td>
      </tr>
      <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:8pt; color:#999999;";

$style = "font-family:돋움; font-size:8pt; color:#636363;";
?>

<!--이미지 가로와 세로의 크기를 정해주세요 -->
 <? echo "<a href='{$list[$i][href]}' onfocus='this.blur()'><img

src='$img' width='80' height='80' border='0'></a>"; ?>
<!--사이즈 width='80' 과 height='80'이 기본설정입니다. 자신에 맞게 수

정하세요 --> </div></td>
                  </tr>
                  <tr>
                    <td height="2"></td>
                  </tr>
                </table>
            </div></td>
<!--가로이미지 숫자를 정해주세요 -->   
        <? if ($m%7==0){ ?>
<!--가로이미지 숫자와 최신게시물을 부를때 갯수와는 다릅니다. -->
          </tr>
          <tr>
            <?}?>
            <? } ?>
            <? if (count($list) == 0) { echo "<td height=30

align=center>no image.</td>"; } ?>
          </tr>
        </table>
          </div></td>
      </tr>
    </table></td>
    <td background='<?=$latest_skin_path?>/img/5.gif'></td>
  </tr>
  <tr>
    <td height='5'><img src='<?=$latest_skin_path?>/img/6.gif'

width='5' height='5' border='0'></td>
    <td background='<?=$latest_skin_path?>/img/7.gif'></td>
    <td><img src='<?=$latest_skin_path?>/img/8.gif' width='5'

height='5' border='0'></td>
  </tr>
</table>

댓글 전체

두가지 방법을 제시해 드릴께요.

첫번째는 이미지 파일이 없는지 체크해서 없으면 대신 쓸 이미지 경로를 적어주면 되구요. 예로 $img= $thurmb; 다음 줄에 if (!file_exists($img)) { $img="<!--원하는 이미지 경로를 넣어주세요-->"}를 적어줍니다.

여기 '<!--원하는 이미지 경로를 넣어주세요-->'문구에다 원하는 이미지 경로를 적어야 합니다. 그대로 쓰면 안되구요...

두번째로는 의심스런 이미지 img 태그안에 onerror="this.src='<!--원하는 이미지 경로를 넣어주세요-->'"를 넣도록 소스를 수정해 보세요.

예를 들면 위에서 <img src='$img' width='80' height='80' border='0'>를 <img src='$img' width='80' height='80' border='0' onerror=\"this.src='<!--원하는 이미지의 경로-->'\" />로 하면 되지 않을까 싶네요.

둘중 하나를 하시면 될 것 같네요.
스킨 게시판을 보시면  이미지 없을때  noimage.gif 가 뜨도록 제작된 것이 있습니다.
참고>  http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=75593
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT