5.3 버전 내용 적용
This commit is contained in:
@ -349,14 +349,17 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h
|
||||
} else { // 비율에 맞게 생성
|
||||
$dst = imagecreatetruecolor($dst_w, $dst_h);
|
||||
$bgcolor = imagecolorallocate($dst, 255, 255, 255); // 배경색
|
||||
if($src_w > $src_h) {
|
||||
$tmp_h = round(($dst_w * $src_h) / $src_w);
|
||||
$dst_y = round(($dst_h - $tmp_h) / 2);
|
||||
$dst_h = $tmp_h;
|
||||
} else {
|
||||
$tmp_w = round(($dst_h * $src_w) / $src_h);
|
||||
$dst_x = round(($dst_w - $tmp_w) / 2);
|
||||
$dst_w = $tmp_w;
|
||||
|
||||
if ( !((defined('G5_USE_THUMB_RATIO') && false === G5_USE_THUMB_RATIO) || (defined('G5_THEME_USE_THUMB_RATIO') && false === G5_THEME_USE_THUMB_RATIO)) ){
|
||||
if($src_w > $src_h) {
|
||||
$tmp_h = round(($dst_w * $src_h) / $src_w);
|
||||
$dst_y = round(($dst_h - $tmp_h) / 2);
|
||||
$dst_h = $tmp_h;
|
||||
} else {
|
||||
$tmp_w = round(($dst_h * $src_w) / $src_h);
|
||||
$dst_x = round(($dst_w - $tmp_w) / 2);
|
||||
$dst_w = $tmp_w;
|
||||
}
|
||||
}
|
||||
|
||||
if($size[2] == 3) {
|
||||
@ -382,34 +385,64 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h
|
||||
$dst = imagecreatetruecolor($dst_w, $dst_h);
|
||||
$bgcolor = imagecolorallocate($dst, 255, 255, 255); // 배경색
|
||||
|
||||
if($src_w < $dst_w) {
|
||||
if($src_h >= $dst_h) {
|
||||
if( $src_h > $src_w ){
|
||||
$tmp_w = round(($dst_h * $src_w) / $src_h);
|
||||
$dst_x = round(($dst_w - $tmp_w) / 2);
|
||||
$dst_w = $tmp_w;
|
||||
} else {
|
||||
if ( ((defined('G5_USE_THUMB_RATIO') && false === G5_USE_THUMB_RATIO) || (defined('G5_THEME_USE_THUMB_RATIO') && false === G5_THEME_USE_THUMB_RATIO)) ){
|
||||
//이미지 썸네일을 비율 유지하지 않습니다. (5.2.6 버전 이하에서 처리된 부분과 같음)
|
||||
|
||||
if($src_w < $dst_w) {
|
||||
if($src_h >= $dst_h) {
|
||||
$dst_x = round(($dst_w - $src_w) / 2);
|
||||
$src_h = $dst_h;
|
||||
if( $dst_w > $src_w ){
|
||||
$dst_w = $src_w;
|
||||
}
|
||||
} else {
|
||||
$dst_x = round(($dst_w - $src_w) / 2);
|
||||
$dst_y = round(($dst_h - $src_h) / 2);
|
||||
$dst_w = $src_w;
|
||||
$dst_h = $src_h;
|
||||
}
|
||||
} else {
|
||||
$dst_x = round(($dst_w - $src_w) / 2);
|
||||
$dst_y = round(($dst_h - $src_h) / 2);
|
||||
$dst_w = $src_w;
|
||||
$dst_h = $src_h;
|
||||
}
|
||||
} else {
|
||||
if($src_h < $dst_h) {
|
||||
if( $src_w > $dst_w ){
|
||||
$tmp_h = round(($dst_w * $src_h) / $src_w);
|
||||
$dst_y = round(($dst_h - $tmp_h) / 2);
|
||||
$dst_h = $tmp_h;
|
||||
} else {
|
||||
if($src_h < $dst_h) {
|
||||
$dst_y = round(($dst_h - $src_h) / 2);
|
||||
$dst_h = $src_h;
|
||||
$src_w = $dst_w;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
//이미지 썸네일을 비율 유지하며 썸네일 생성합니다.
|
||||
if($src_w < $dst_w) {
|
||||
if($src_h >= $dst_h) {
|
||||
if( $src_h > $src_w ){
|
||||
$tmp_w = round(($dst_h * $src_w) / $src_h);
|
||||
$dst_x = round(($dst_w - $tmp_w) / 2);
|
||||
$dst_w = $tmp_w;
|
||||
} else {
|
||||
$dst_x = round(($dst_w - $src_w) / 2);
|
||||
$src_h = $dst_h;
|
||||
if( $dst_w > $src_w ){
|
||||
$dst_w = $src_w;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$dst_x = round(($dst_w - $src_w) / 2);
|
||||
$dst_y = round(($dst_h - $src_h) / 2);
|
||||
$dst_w = $src_w;
|
||||
$dst_h = $src_h;
|
||||
}
|
||||
} else {
|
||||
if($src_h < $dst_h) {
|
||||
if( $src_w > $dst_w ){
|
||||
$tmp_h = round(($dst_w * $src_h) / $src_w);
|
||||
$dst_y = round(($dst_h - $tmp_h) / 2);
|
||||
$dst_h = $tmp_h;
|
||||
} else {
|
||||
$dst_y = round(($dst_h - $src_h) / 2);
|
||||
$dst_h = $src_h;
|
||||
$src_w = $dst_w;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($size[2] == 3) {
|
||||
|
||||
Reference in New Issue
Block a user