From bd33a31a10a9737887522c4f8e6564b126f01a40 Mon Sep 17 00:00:00 2001 From: kagla Date: Fri, 25 Jun 2021 14:03:45 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9B=80=EC=A7=81=EC=9D=B4=EB=8A=94=20webp=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=97=85=EB=A1=9C=EB=93=9C=20?= =?UTF-8?q?=EA=B0=80=EB=8A=A5=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/thumbnail.lib.php | 22 +++++++++++++------ .../photo_uploader/popup/index.html | 8 +++---- .../popup/php/UploadHandler.php | 4 ++-- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/lib/thumbnail.lib.php b/lib/thumbnail.lib.php index 1150a221f..15eede63a 100644 --- a/lib/thumbnail.lib.php +++ b/lib/thumbnail.lib.php @@ -85,7 +85,7 @@ function get_file_thumbnail($file){ if( ! is_array($file) ) return ''; - if( preg_match('/(\.jpg|\.jpeg|\.gif|\.png|\.bmp)$/i', $file['file']) && $contents = run_replace('get_file_thumbnail_tags', '', $file) ){ + if( preg_match('/(\.jpg|\.jpeg|\.gif|\.png|\.bmp|\.webp)$/i', $file['file']) && $contents = run_replace('get_file_thumbnail_tags', '', $file) ){ return $contents; } else if ($file['view']) { return get_view_thumbnail($file['view']); @@ -108,6 +108,8 @@ function get_view_thumbnail($contents, $thumb_width=0) if(empty($matches)) return $contents; + // $extensions = array(1=>'gif', 2=>'jpg', 3=>'png', 18=>'webp'); + for($i=0; $i 'gif', 2 => 'jpg', 3 => 'png', 18 => 'webp'); - $file_ext = $extensions[$size[2]]; // 파일 확장자 + // $extensions = array(1 => 'gif', 2 => 'jpg', 3 => 'png', 18 => 'webp'); + // $file_ext = $extensions[$size[2]]; // 파일 확장자 + $file_ext = G5_IMAGE_EXTENSIONS[$size[2]]; + if (!$file_ext) return; // gif, jpg, png, webp 에 대해서만 적용 // if ( !(isset($size[2]) && ($size[2] == 1 || $size[2] == 2 || $size[2] == 3 || $size[2] == 18)) ) // return; // $extensions 배열에 없는 확장자 라면 썸네일 만들지 않음 - if (!in_array($file_ext, $extensions)) - return; + // if (!in_array($file_ext, $extensions)) + // return; if (!is_dir($target_path)) { @mkdir($target_path, G5_DIR_PERMISSION); diff --git a/plugin/editor/smarteditor2/photo_uploader/popup/index.html b/plugin/editor/smarteditor2/photo_uploader/popup/index.html index da775dd2d..ddf0dcf74 100644 --- a/plugin/editor/smarteditor2/photo_uploader/popup/index.html +++ b/plugin/editor/smarteditor2/photo_uploader/popup/index.html @@ -55,13 +55,13 @@ - - + + - + - + \ No newline at end of file diff --git a/plugin/editor/smarteditor2/photo_uploader/popup/php/UploadHandler.php b/plugin/editor/smarteditor2/photo_uploader/popup/php/UploadHandler.php index c0381ba6a..8d26192a2 100644 --- a/plugin/editor/smarteditor2/photo_uploader/popup/php/UploadHandler.php +++ b/plugin/editor/smarteditor2/photo_uploader/popup/php/UploadHandler.php @@ -1092,7 +1092,7 @@ class UploadHandler //throw new Exception("Invalid image MIME type"); return false; } - + $image_from_file = self::$MIME_TYPES_PROCESSORS[$mime_type][0]; $image_to_file = self::$MIME_TYPES_PROCESSORS[$mime_type][1]; @@ -1101,7 +1101,7 @@ class UploadHandler // https://stackoverflow.com/questions/61394477/php-e-error-gd-webp-cannot-allocate-temporary-buffer // 움직이는 webp 이미지나 큰사이즈의 webp 이미지에 대한 해결 방안은 아직 없는 것 같다 $reprocessed_image = @$image_from_file($file_path); - // error_log("\$image_from_file = '$image_from_file', \$image_to_file = '$image_to_file', \$reprocessed_image = '$reprocessed_image' "); + // error_log("\$image_from_file = '$image_from_file', \$image_to_file = '$image_to_file', \$reprocessed_image = '$reprocessed_image', \$file_path ='$file_path' "); if (!$reprocessed_image) { //throw new Exception("Unable to create reprocessed image from file");