CHEDITOR5로 올린 이미지 폭을 줄일 수 없을까요? 정보
CHEDITOR5로 올린 이미지 폭을 줄일 수 없을까요?본문
CHEDITOR5로 올린 이미지 폭을 줄일 수 없을까요?
파일첨부로 올린 이미지 폭은 write_update.skin.php에 아래 소스 넣으니 줄일 수 있던에요.
// 자신만의 코드를 넣어주세요.
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb';
$sql2=" select * from $g4[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];
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_image_width] / $size[0];
$height = (int)($size[1] * $rate);
if ($size[0] > $board[bo_image_width]){
@unlink($data_path.'/'.$row2[bf_file]);
$dst = imagecreatetruecolor($board[bo_image_width], $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $board[bo_image_width], $height, $size[0], $size[1]);
// imagepng($dst, $data_path.'/'.$row2[bf_file], $board[bo_3]);
//이부분이 png 압축방식이어서 이미지 커졌나 봅니다.
//아래처럼 하니 줄어드는 것을 확실히 느껴집니다....^^
imagejpeg($dst, $data_path.'/'.$row2[bf_file], $board[bo_3]);
chmod($data_path.'/'.$row2[bf_file], 0606);
$temp = @getimagesize(addslashes($file));
//---------->madem님이 알려주신 부분입니다.^^
$bf_size = @filesize(addslashes($file));
$sql = " update $g4[board_file_table]
set bf_filesize = '$bf_size', bf_width='$temp[0]', bf_height='$temp[1]', bf_type='$temp[2]'
where bo_table = '$bo_table' and wr_id = '$wr_id' ";
sql_query($sql);
//---------->madem님이 알려주신 부분입니다.^^
}
}
}
}
if ($size[0] > $board[bo_image_width]){
}
파일첨부로 올린 이미지 폭은 write_update.skin.php에 아래 소스 넣으니 줄일 수 있던에요.
// 자신만의 코드를 넣어주세요.
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb';
$sql2=" select * from $g4[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];
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_image_width] / $size[0];
$height = (int)($size[1] * $rate);
if ($size[0] > $board[bo_image_width]){
@unlink($data_path.'/'.$row2[bf_file]);
$dst = imagecreatetruecolor($board[bo_image_width], $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $board[bo_image_width], $height, $size[0], $size[1]);
// imagepng($dst, $data_path.'/'.$row2[bf_file], $board[bo_3]);
//이부분이 png 압축방식이어서 이미지 커졌나 봅니다.
//아래처럼 하니 줄어드는 것을 확실히 느껴집니다....^^
imagejpeg($dst, $data_path.'/'.$row2[bf_file], $board[bo_3]);
chmod($data_path.'/'.$row2[bf_file], 0606);
$temp = @getimagesize(addslashes($file));
//---------->madem님이 알려주신 부분입니다.^^
$bf_size = @filesize(addslashes($file));
$sql = " update $g4[board_file_table]
set bf_filesize = '$bf_size', bf_width='$temp[0]', bf_height='$temp[1]', bf_type='$temp[2]'
where bo_table = '$bo_table' and wr_id = '$wr_id' ";
sql_query($sql);
//---------->madem님이 알려주신 부분입니다.^^
}
}
}
}
if ($size[0] > $board[bo_image_width]){
}
댓글 전체