섬네일을 가로 2개로 세로로 나열하는 법 좀 부탁드립니다. 정보
섬네일을 가로 2개로 세로로 나열하는 법 좀 부탁드립니다.본문
//파일 뽑기
$sql = " select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no limit 0, 10 ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
//썸네일 코드 시작
$data_path = $g4['path'] . "/data/file/{$bo_table}";//라이브러리 파일 참조
$thumb_path = $data_path . '/thumbOpen';
$view_w = 110; //썸네일 가로사이즈
$view_h = 83; //썸네일 세로사이즈
$sch_q = 100; //썸네일 퀼리티
if (!is_dir($thumb_path)) {
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
}
$filename = $row[bf_file]; //파일명
$thumb = $thumb_path.'/'.$filename; //썸네일
if (!file_exists($thumb))
{
$file = $data_path.'/'.$filename; //원본
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
continue;
$rate = $view_w / $size[0];
$height = (int)($size[1] * $rate);
if ($height < $view_h)
$dst = imagecreatetruecolor($view_w, $height);
else
$dst = imagecreatetruecolor($view_w, $view_h);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $view_w, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$filename, $sch_q);
chmod($thumb_path.'/'.$filename, 0707);
}
}
if (file_exists($thumb) && $filename) {
?>
<a href="javascript:void(0);" onClick="View_Open('<?=$data_path?>/<?=$filename?>')" onMouseOver="bgChange('view_img<?=$i?>');" onMouseOut="bgChange('view_img<?=$i?>');"><img src='<?=$thumb?>' border=1 width=88 height=66 style="border-color:#d5d5d5;"></a> <?
//onMouseOut="bgChange('clear');"
}
}
어느분 스킨을 짜집기 중인데...큰 사진 오른쪽으로 섬네일 이미지가 가로 2개씩 세로로 보여줬으면 합니다.
제일 밑 부분을 바꿔야 할 것 같은데, 초짜다 보니 .... ㅠㅜ
도움 좀 부탁드립니다.
$sql = " select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no limit 0, 10 ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
//썸네일 코드 시작
$data_path = $g4['path'] . "/data/file/{$bo_table}";//라이브러리 파일 참조
$thumb_path = $data_path . '/thumbOpen';
$view_w = 110; //썸네일 가로사이즈
$view_h = 83; //썸네일 세로사이즈
$sch_q = 100; //썸네일 퀼리티
if (!is_dir($thumb_path)) {
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
}
$filename = $row[bf_file]; //파일명
$thumb = $thumb_path.'/'.$filename; //썸네일
if (!file_exists($thumb))
{
$file = $data_path.'/'.$filename; //원본
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
continue;
$rate = $view_w / $size[0];
$height = (int)($size[1] * $rate);
if ($height < $view_h)
$dst = imagecreatetruecolor($view_w, $height);
else
$dst = imagecreatetruecolor($view_w, $view_h);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $view_w, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$filename, $sch_q);
chmod($thumb_path.'/'.$filename, 0707);
}
}
if (file_exists($thumb) && $filename) {
?>
<a href="javascript:void(0);" onClick="View_Open('<?=$data_path?>/<?=$filename?>')" onMouseOver="bgChange('view_img<?=$i?>');" onMouseOut="bgChange('view_img<?=$i?>');"><img src='<?=$thumb?>' border=1 width=88 height=66 style="border-color:#d5d5d5;"></a> <?
//onMouseOut="bgChange('clear');"
}
}
어느분 스킨을 짜집기 중인데...큰 사진 오른쪽으로 섬네일 이미지가 가로 2개씩 세로로 보여줬으면 합니다.
제일 밑 부분을 바꿔야 할 것 같은데, 초짜다 보니 .... ㅠㅜ
도움 좀 부탁드립니다.
댓글 전체
현재 올리신 부분 소스 윗부분 테그가 어떻게 되어 있는지 알수가 없네요.
아래 부분(<= 해당테그에 맟추서 넣어주세요) 부분을 응용해 보세요.
if (file_exists($thumb) && $filename) {
if($i%2 == "0") echo "</td></tr><tr><td>"; <= 해당테그에 맞춰서 넣어주세요.
?>
<a href="javascript:void(0);" onClick="View_Open('<?=$data_path?>/<?=$filename?>')" onMouseOver="bgChange('view_img<?=$i?>');" onMouseOut="bgChange('view_img<?=$i?>');"><img src='<?=$thumb?>' border=1 width=88 height=66 style="border-color:#d5d5d5;"></a> <?
//onMouseOut="bgChange('clear');"
아래 부분(<= 해당테그에 맟추서 넣어주세요) 부분을 응용해 보세요.
if (file_exists($thumb) && $filename) {
if($i%2 == "0") echo "</td></tr><tr><td>"; <= 해당테그에 맞춰서 넣어주세요.
?>
<a href="javascript:void(0);" onClick="View_Open('<?=$data_path?>/<?=$filename?>')" onMouseOver="bgChange('view_img<?=$i?>');" onMouseOut="bgChange('view_img<?=$i?>');"><img src='<?=$thumb?>' border=1 width=88 height=66 style="border-color:#d5d5d5;"></a> <?
//onMouseOut="bgChange('clear');"