이미지 없을경우 noimg 파일 출력하려면 어떻게 ?

리스트 파일에 잇는 이미지보여주는 코드입니다.

이미지파일 없을 경우 noimg 파일을 보여 주고 싶은데 어떻게 수정해야 하나요 ?



<?
if ($list[$i]['link'][1] != "") {
?>
<a href="<?=$list[$i]['link'][1]?>" target="_blank"><img src="<?=$list[$i]['file'][0]['path']?>/<?=$list[$i]['file'][0]['file']?>" width="70" height="50" border="0"></a>
<?
}
else {
?>
<img src="<?=$list[$i]['file'][0]['path']?>/<?=$list[$i]['file'][0]['file']?>" width="70" height="50">
<?
}
?>
|

댓글 3개

<? if ($list[$i]['link'][1] != "") { ?>
<a href="<?=$list[$i]['link'][1]?>" target="_blank"><img src="<?=$list[$i]['file'][0]['path']?>/<?=$list[$i]['file'][0]['file']?>" width="70" height="50" border="0"></a>
<? } else { ?>
<img src="noimg파일 위치/noimg.gif"> <== 이거 아닌가요? ㅡ.ㅡ
<? } ?>
별이되고싶어님~

ㅠ.ㅠ 그쪽을 바꾸니 리스트 있는 이미지들 전체가 바뀌네요
별이님이 착각하신듯. 링크가 없을때 노이미지 나오게 하신거 같은데요.
<? if ($list[$i]['link'][1] != "") // 링크 1에 값이 있다면
{
if($list[$i]['file'][0]['file']) // 파일이 있다면
{
$img= $list[$i]['file'][0]['path']."/".$list[$i]['file'][0]['file'];// 파일 경로
}
else // 파일이 없다면
{
$img= $board_skin_path."/img/noimg.gif"; //해당 스킨 이미지폴더의 노이미지
}?>
<a href="<?=$list[$i]['link'][1]?>" target="_blank"><img src="<?=$img?>" width="70" height="50" border="0"></a>
<? } ?>

이렇게 해보시면....
적용을 안해봐서 어디에 에러가 있을지도 모름. ㅋㅋ

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기
🐛 버그신고