첨부이미지가 1개이상일때
본문
<?
for ($p=0; $p<count($list[$i][file]); $p++) {
// 이미지 체크
$image = urlencode($list[$i][file][$p][file]);
$ori="$g4[path]/data/file/$bo_table/" . $image;
$ext = strtolower(substr(strrchr($ori,"."), 1)); //확장자
// 이미지가 있다면.
if ($ext=="gif"||$ext=="jpg"||$ext=="jpeg"||$ext=="png"||$ext=="bmp"||$ext=="tif"||$ext=="tiff") {
// 섬네일 경로 만들기 + 섬네일 생성
$list_img_path = $list[$i][file][$p][path]."/".$list[$i][file][$p][file];
$list_thumb = thumbnail($list_img_path , 360, 320,0,1,100);
//echo "<span >";
echo "<a href=";
echo $list[$i][comment_href];
echo " target='_self'>";
echo "<img src='$list_thumb' width='100%' style=' border:0px solid grey; padding:0px; ' />";
echo "</a>";
//echo "</span>";
}
}
?>
이렇게 썸네일 불러다가 쓰는데
목록에서 이미지를 불러와서 쓰고있습니다.,
이미지를 1개이상 올렸을때는
목록에서 1개만 표시하고 싶은데
2개 올렸다고 치면
2개 다뜨네요.ㅠ
어떻게해야할까요?
답변 1
$p++
$p가 0이면 첫번째 첨부파일만 불러올텐데...
++가 되어 있으니...쭉 뽑아 오는게 아닐까요
$list[$i][file][0][file];
이런식으로 하셔야...1개만 불러올거에요
답변을 작성하시기 전에 로그인 해주세요.