최근게시물에서 이미지가 없을 때 noimage.gif 출력 정보
최근게시물에서 이미지가 없을 때 noimage.gif 출력
관련링크
첨부파일
본문
아래 빨간줄부분인데 이거랑 비슷하게 집어넣음 될것같은데 정확하게 어떻게 넣는지 모르겠습니다.
else{
echo"<img src='$latest_skin_path/img/noimage.gif' width='190' border='0'></a><br>";
}
복사해서 넣으니 에러가 납니다.
가르쳐주시면 감사하겠습니다.
감사합니다.
<?
$image = $list[$i][file][0][file]; //원본
$img=$data_path. "/".$image; //썸네일이 없을경우 원본출력
$thumb = $thumb_path. "/". $list[$i][wr_id];
if ( file_exists($thumb) )
$img = $thumb;
$style = "font-family:돋움; font-size:9pt; color:#666666;";
if ($list[$i][icon_new])
$style = "style='font-family:돋움; font-size:9pt; color:#666666;' ";
$subject = "<span $style>".cut_str($list[$i][subject],20)."</span>"; //제목 글자수 자르기
$bg = ""; //새글?
if ($list[$i][icon_new])
$bg="la_top_2.gif";
else
$bg="la_top_1.gif";
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='100' height='70' border='0'></a></td></tr>";
echo " <tr><td height='21' align='center'><a href='{$list[$i]['href']}'>{$subject}</a></td></tr></table>";
?>
댓글 전체
<? for ($i=0; $i<count($list); $i++) {
$thumb = $thumb_path.'/'.$list[$i][wr_id];
if (file_exists($thumb))
$thumfile = "$thumb";
else
//이미지가 없으면
$thumfile="<img src='$latest_skin_path/img/noimg.gif' width='{$img_width_s}' height='{$img_height_s}' style='border:0 #E7E7E7 solid'></a>";
//이미지가 아니네
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>"; }
지금필요한건?
에러메세지!
어떻게 표현하는지 질문드린것입니다.
스킨이 만들다 만것 같이 좀 그러네요.
위 소스는 썸네일이 생성되어있다 는 가정하에 돌아가게 되어있습니다.
원본디랙을 검사해서 원본이미지가 있을경우 wr_id에 물린 이미지를 썸디랙에 썸파일을 만들고
썸파일유무검사해서 noimg를 뿌리게 되야 정상인데...
위소스는
썸생성 하는 부분도 없는데 필요없이 썸디랙을 검색하고 // 디랙생성, 파일생성이 다 빠져있습니다. 검색부분 삭제해버리세요.
만약 썸파일이 없으면 원본이미지를 불러오고 // 바로 원본을 불러오게 만드시구요
썸디랙도 없는데 썸디랙을 검사해서 없으면 noimg를 띄우게 되어있어요 // 여기서 에러가 날겁니다.
wr_id에 물린 원본이미지가 있는지 없는지를 비교하는 루틴이 하나 더 들어가야 됩니다.
그리고 원본이 없으면 noimg가 뜨도록...
썸네일 생성은 갤러리에서하고
그 갤러리의 썸네일을 불러옵니다.
최신글에서는 썸네일을 재 생성하지 않으므로 효율적이죠...
$image = $list[$i][file][0][file]; //원본
$noimg = $latest_skin_path."/img/noimage.gif"; ///////////// 여기 노이미지
$img=$data_path. "/".$image; //썸네일이 없을경우 원본출력
$thumb = $thumb_path. "/". $list[$i][wr_id];
if ( file_exists($thumb) ) //썸네일이 있다면
$img = $thumb;
else if($image) //원본이미지가 있다면
$img = $image;
else
$img = $noimg; //가난해서 썸네일도 없고 원본이미지도 없으면 노이미지 출력
$style = "font-family:돋움; font-size:9pt; color:#666666;";
..........
스킨이 만들다 만것 같이 좀 그러네요 <- 죄송합니다. ^^
48시간님 답변도 맞습니다.
예전에 갤러리와 세트로 올린것이라서...
즐거운 저녁되세요^^
/x----