기본 스킨의 겔러리 스킨에서 업로드하는 모든 파일 썸네일 이미지 생성 정보
기본 스킨의 겔러리 스킨에서 업로드하는 모든 파일 썸네일 이미지 생성본문
http://sir.co.kr/bbs/tb.php/g4_skin_basic/4
스킨에 보면... write_update.skin.php 파일의 일부 인데요...
이 소스가 썸네일 파일을 $wr_id 명으로 하나만 생성하게되는데요...
아래소스를 사용해서 업로드 되는 모든 파일의 썸네일 이미지를 만드려고 합니다...
어떻게 수정을 해야할지...
if ($_FILES[bf_file][name][0])
{
$row = sql_fetch(" select * from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '0' ");
$file = $data_path .'/'. $row[bf_file];
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 = $board[bo_1] / $size[0];
$height = (int)($size[1] * $rate);
@unlink($thumb_path.'/'.$wr_id);
$dst = imagecreatetruecolor($board[bo_1], $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $board[bo_1], $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$wr_id, $board[bo_2]);
chmod($thumb_path.'/'.$wr_id, 0606);
}
}
스킨에 보면... write_update.skin.php 파일의 일부 인데요...
이 소스가 썸네일 파일을 $wr_id 명으로 하나만 생성하게되는데요...
아래소스를 사용해서 업로드 되는 모든 파일의 썸네일 이미지를 만드려고 합니다...
어떻게 수정을 해야할지...
if ($_FILES[bf_file][name][0])
{
$row = sql_fetch(" select * from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '0' ");
$file = $data_path .'/'. $row[bf_file];
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 = $board[bo_1] / $size[0];
$height = (int)($size[1] * $rate);
@unlink($thumb_path.'/'.$wr_id);
$dst = imagecreatetruecolor($board[bo_1], $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $board[bo_1], $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$wr_id, $board[bo_2]);
chmod($thumb_path.'/'.$wr_id, 0606);
}
}
댓글 전체
bbs/write_update.php 화일 내
171행에 썸네일 생성부분을 include 시키면 되겟네요
171행에 썸네일 생성부분을 include 시키면 되겟네요