최근갤러리 FOR 문을좀 수정할려 합니다. 정보
최근갤러리 FOR 문을좀 수정할려 합니다.본문
총 3개의 이미지를 뽑아올때
첫번째 이미지는 빈칸이고 두번째는 우측상단 세번째는 좌측하단 네번째는 우측하단
이렇게 뽑아볼려고 합니다.
아래의 소스에서 어떻게 수정을 하면 좋을지.. 부탁드립니다.
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<? for ($i=0; $i<count($list); $i++) {
if ($i>0 && $i%$cols==0) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; }
?>
<td align="center" valign='top' style='padding-left:3px;'>
<?
$img = "이미지 없음";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
if (!file_exists($thumb))
{
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file))
{
$size = getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;
$rate = $thum_width / $size[0];
$height = (int)($size[1] * $rate);
$dst = imagecreatetruecolor($thum_width, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $thum_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $image_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' alt='{$list[$i][subject]}' border='0'>";
// $img = "<img src='$thumb' alt='{$list[$i][subject]}' width='90' height='60' border='0' style='border:1 solid #C6C6C6;'>"; // 썸네일 가로 세로 고정시 사용
echo $list[$i][icon_reply] . " ";
echo "<table cellpadding=0 cellspacing=1 border=0><tr>";
echo "<td><div style='width:88px; height:73px;border:1 solid #C6C6C6; position: relative; overflow:hidden;' align=center valign=center><a href={$list[$i]['href']} onfocus=\"this.blur()\">$img</a></div></td>";
//echo "</tr><tr align=center><td height=20 valign=bottom>{$list[$i]['subject']}</td>";
echo "</tr></table>";
?>
</td>
<? } ?>
<?
$cnt = ($i%$cols);
for ($k=$cnt; $k<$cols && $cnt; $k++) {
echo "<td></td>";
}
?>
<? if (count($list) == 0) { echo "<td height=80 align=center>게시물이 없습니다.</td>"; } ?>
</tr>
</table>
첫번째 이미지는 빈칸이고 두번째는 우측상단 세번째는 좌측하단 네번째는 우측하단
이렇게 뽑아볼려고 합니다.
아래의 소스에서 어떻게 수정을 하면 좋을지.. 부탁드립니다.
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<? for ($i=0; $i<count($list); $i++) {
if ($i>0 && $i%$cols==0) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; }
?>
<td align="center" valign='top' style='padding-left:3px;'>
<?
$img = "이미지 없음";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
if (!file_exists($thumb))
{
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file))
{
$size = getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;
$rate = $thum_width / $size[0];
$height = (int)($size[1] * $rate);
$dst = imagecreatetruecolor($thum_width, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $thum_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $image_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' alt='{$list[$i][subject]}' border='0'>";
// $img = "<img src='$thumb' alt='{$list[$i][subject]}' width='90' height='60' border='0' style='border:1 solid #C6C6C6;'>"; // 썸네일 가로 세로 고정시 사용
echo $list[$i][icon_reply] . " ";
echo "<table cellpadding=0 cellspacing=1 border=0><tr>";
echo "<td><div style='width:88px; height:73px;border:1 solid #C6C6C6; position: relative; overflow:hidden;' align=center valign=center><a href={$list[$i]['href']} onfocus=\"this.blur()\">$img</a></div></td>";
//echo "</tr><tr align=center><td height=20 valign=bottom>{$list[$i]['subject']}</td>";
echo "</tr></table>";
?>
</td>
<? } ?>
<?
$cnt = ($i%$cols);
for ($k=$cnt; $k<$cols && $cnt; $k++) {
echo "<td></td>";
}
?>
<? if (count($list) == 0) { echo "<td height=80 align=center>게시물이 없습니다.</td>"; } ?>
</tr>
</table>
댓글 전체