갤러리 세로 이미지 회전
본문
아래의 소스는 skin/게시판스킨/ write_update.skin.php 파일 소스입니다.
"write_update.skin.php" 요 파일이 없으면 원본이 너무커서 "write_update.skin.php" 이 파일에서 강제로 사이즈를 줄이는데 문제는 세로 사진을 올리면 왼쪽으로 90도 누워서 올라가네요.
어떻게 수정해야 할까요? 해당 파일이 없으면 정상적으로 올라갑니다.
<?
if (!defined("_GNUBOARD_")) exit;
$data_path = G5_PATH."/data/file/$bo_table";
$thumb_path = $data_path;
$img_width = $board['bo_image_width'];
$sql2=" select * from $g5[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no asc";
$results2 = sql_query($sql2);
for ($d=0; $row2=sql_fetch_array($results2); $d++) {
if ($_FILES[bf_file][name][$d])
{
$file = $data_path .'/'. $row2[bf_file];
$IMG_info = getimagesize ($file);
$thum_W = $IMG_info[0] ;
if ($thum_W > $img_width) {
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $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 = $img_width / $size[0];
$height = (int)($size[1] * $rate);
@unlink($data_path.'/'.$row2[bf_file]);
$dst = imagecreatetruecolor($img_width, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagejpeg($dst, $data_path.'/'.$row2[bf_file], $board[bo_2]);
//imagepng($dst, $data_path.'/'.$row2[bf_file], $board[bo_2]);
chmod($data_path.'/'.$row2[bf_file], 0606);
}
}
}
}
?>