diff --git a/AvocadoAmber/lib/thumbnail.lib.php b/AvocadoAmber/lib/thumbnail.lib.php index d2d0d9e..ba3990a 100644 --- a/AvocadoAmber/lib/thumbnail.lib.php +++ b/AvocadoAmber/lib/thumbnail.lib.php @@ -5,7 +5,7 @@ if (!defined('_GNUBOARD_')) @ini_set('memory_limit', '-1'); // 게시글리스트 썸네일 생성 -function get_list_thumbnail($bo_table, $wr_id, $thumb_width, $thumb_height, $is_create = false, $is_crop = false, $crop_mode = 'center', $is_sharpen = false, $um_value = '80/0.5/3') +function get_list_thumbnail($bo_table, $wr_id, $thumb_width, $thumb_height, $is_create = false, $is_crop = false, $crop_mode = 'center', $is_sharpen = false, $um_value = '80/0.5/3', $distance = '0') { global $g5, $config; $filename = $alt = $data_path = ''; @@ -66,7 +66,7 @@ function get_list_thumbnail($bo_table, $wr_id, $thumb_width, $thumb_height, $is_ return $thumbnail_info; } - $tname = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, $is_create, $is_crop, $crop_mode, $is_sharpen, $um_value); + $tname = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, $is_create, $is_crop, $crop_mode, $is_sharpen, $um_value, $distance); if ($tname) { if ($edt) { @@ -229,7 +229,7 @@ function get_view_thumbnail($contents, $thumb_width = 0) return run_replace('get_view_thumbnail', $contents); } -function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_height, $is_create, $is_crop = false, $crop_mode = 'center', $is_sharpen = false, $um_value = '80/0.5/3') +function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_height, $is_create, $is_crop = false, $crop_mode = 'center', $is_sharpen = false, $um_value = '80/0.5/3', $distance = '0') { global $g5; @@ -384,6 +384,14 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h $src_x = round(($size[0] - $src_w) / 2); } break; + case 'custom': + if ($size[1] / $size[0] >= $ratio) { + $src_h = round($src_w * $ratio); + $src_y = $distance; + } else { + $src_w = round($size[1] / $ratio); + } + break; default: if ($size[1] / $size[0] >= $ratio) { $src_h = round($src_w * $ratio);