diff --git a/modules/admin/lang/en.php b/modules/admin/lang/en.php index 0418b6f0b..d878732f0 100644 --- a/modules/admin/lang/en.php +++ b/modules/admin/lang/en.php @@ -270,7 +270,6 @@ $lang->thumbnail_target = 'Extract Thumbnail From'; $lang->thumbnail_target_all = 'All images'; $lang->thumbnail_target_attachment = 'Attached images only'; $lang->thumbnail_type = 'Thumbnail Type'; -$lang->thumbnail_quality = 'Quality'; $lang->input_header_script = 'Header Script'; $lang->detail_input_header_script = 'Content added here will be printed at the top of every page, except the admin module.'; $lang->input_footer_script = 'Footer Script'; diff --git a/modules/admin/lang/ko.php b/modules/admin/lang/ko.php index 79918b73f..47998ca54 100644 --- a/modules/admin/lang/ko.php +++ b/modules/admin/lang/ko.php @@ -273,7 +273,6 @@ $lang->detail_input_footer_script = '모든 페이지의 최하단에 코드를 $lang->thumbnail_crop = '크기에 맞추어 잘라내기'; $lang->thumbnail_ratio = '비율 유지 (여백이 생길 수 있음)'; $lang->thumbnail_none = '썸네일 생성하지 않음'; -$lang->thumbnail_quality = '화질'; $lang->admin_ip_allow = '관리자 로그인 허용 IP'; $lang->admin_ip_deny = '관리자 로그인 금지 IP'; $lang->local_ip_address = '로컬 IP 주소'; diff --git a/modules/admin/tpl/config_advanced.html b/modules/admin/tpl/config_advanced.html index 088889545..1e17bf29b 100644 --- a/modules/admin/tpl/config_advanced.html +++ b/modules/admin/tpl/config_advanced.html @@ -136,9 +136,9 @@ {$lang->thumbnail_ratio} - - + diff --git a/modules/file/file.admin.controller.php b/modules/file/file.admin.controller.php index 1b25df824..4989dbd8c 100644 --- a/modules/file/file.admin.controller.php +++ b/modules/file/file.admin.controller.php @@ -74,6 +74,7 @@ class fileAdminController extends file $config->max_image_size_admin = Context::get('max_image_size_admin') === 'Y' ? 'Y' : 'N'; $config->image_quality_adjustment = max(50, min(100, intval(Context::get('image_quality_adjustment')))); $config->image_autorotate = Context::get('image_autorotate') === 'Y' ? true : false; + $config->image_remove_exif_data = Context::get('image_remove_exif_data') === 'Y' ? true : false; $config->video_thumbnail = Context::get('video_thumbnail') === 'Y' ? true : false; $config->video_mp4_gif_time = intval(Context::get('video_mp4_gif_time')); $config->ffmpeg_command = escape(utf8_trim(Context::get('ffmpeg_command'))) ?: '/usr/bin/ffmpeg'; @@ -153,81 +154,82 @@ class fileAdminController extends file */ function procFileAdminInsertModuleConfig() { - $file_config = new stdClass; + $config = new stdClass; // Default if(!Context::get('use_default_file_config')) { - $file_config->use_default_file_config = 'N'; - $file_config->allowed_filesize = Context::get('allowed_filesize'); - $file_config->allowed_attach_size = Context::get('allowed_attach_size'); - $file_config->allowed_filetypes = Context::get('allowed_filetypes'); + $config->use_default_file_config = 'N'; + $config->allowed_filesize = Context::get('allowed_filesize'); + $config->allowed_attach_size = Context::get('allowed_attach_size'); + $config->allowed_filetypes = Context::get('allowed_filetypes'); // Check maximum file size if (PHP_INT_SIZE < 8) { - if ($file_config->allowed_filesize > 2047 || $file_config->allowed_attach_size > 2047) + if ($config->allowed_filesize > 2047 || $config->allowed_attach_size > 2047) { throw new Rhymix\Framework\Exception('msg_32bit_max_2047mb'); } } // Simplify allowed_filetypes - $file_config->allowed_extensions = strtr(strtolower(trim($file_config->allowed_filetypes)), array('*.' => '', ';' => ',')); - if ($file_config->allowed_extensions) + $config->allowed_extensions = strtr(strtolower(trim($config->allowed_filetypes)), array('*.' => '', ';' => ',')); + if ($config->allowed_extensions) { - $file_config->allowed_extensions = array_map('trim', explode(',', $file_config->allowed_filetypes)); - $file_config->allowed_filetypes = implode(';', array_map(function($ext) { + $config->allowed_extensions = array_map('trim', explode(',', $config->allowed_filetypes)); + $config->allowed_filetypes = implode(';', array_map(function($ext) { return '*.' . $ext; - }, $file_config->allowed_extensions)); + }, $config->allowed_extensions)); } else { - $file_config->allowed_extensions = array(); - $file_config->allowed_filetypes = '*.*'; + $config->allowed_extensions = array(); + $config->allowed_filetypes = '*.*'; } } // Image if(!Context::get('use_image_default_file_config')) { - $file_config->use_image_default_file_config = 'N'; - $file_config->image_autoconv['bmp2jpg'] = Context::get('image_autoconv_bmp2jpg') === 'Y' ? true : false; - $file_config->image_autoconv['png2jpg'] = Context::get('image_autoconv_png2jpg') === 'Y' ? true : false; - $file_config->image_autoconv['webp2jpg'] = Context::get('image_autoconv_webp2jpg') === 'Y' ? true : false; - $file_config->image_autoconv['gif2mp4'] = Context::get('image_autoconv_gif2mp4') === 'Y' ? true : false; - $file_config->max_image_width = intval(Context::get('max_image_width')) ?: ''; - $file_config->max_image_height = intval(Context::get('max_image_height')) ?: ''; - $file_config->max_image_size_action = Context::get('max_image_size_action') ?: ''; - $file_config->max_image_size_admin = Context::get('max_image_size_admin') === 'Y' ? 'Y' : 'N'; - $file_config->image_quality_adjustment = max(50, min(100, intval(Context::get('image_quality_adjustment')))); - $file_config->image_autorotate = Context::get('image_autorotate') === 'Y' ? true : false; + $config->use_image_default_file_config = 'N'; + $config->image_autoconv['bmp2jpg'] = Context::get('image_autoconv_bmp2jpg') === 'Y' ? true : false; + $config->image_autoconv['png2jpg'] = Context::get('image_autoconv_png2jpg') === 'Y' ? true : false; + $config->image_autoconv['webp2jpg'] = Context::get('image_autoconv_webp2jpg') === 'Y' ? true : false; + $config->image_autoconv['gif2mp4'] = Context::get('image_autoconv_gif2mp4') === 'Y' ? true : false; + $config->max_image_width = intval(Context::get('max_image_width')) ?: ''; + $config->max_image_height = intval(Context::get('max_image_height')) ?: ''; + $config->max_image_size_action = Context::get('max_image_size_action') ?: ''; + $config->max_image_size_admin = Context::get('max_image_size_admin') === 'Y' ? 'Y' : 'N'; + $config->image_quality_adjustment = max(50, min(100, intval(Context::get('image_quality_adjustment')))); + $config->image_autorotate = Context::get('image_autorotate') === 'Y' ? true : false; + $config->image_remove_exif_data = Context::get('image_remove_exif_data') === 'Y' ? true : false; } // Video if(!Context::get('use_video_default_file_config')) { - $file_config->use_video_default_file_config = 'N'; - $file_config->video_thumbnail = Context::get('video_thumbnail') === 'Y' ? true : false; - $file_config->video_mp4_gif_time = intval(Context::get('video_mp4_gif_time')); + $config->use_video_default_file_config = 'N'; + $config->video_thumbnail = Context::get('video_thumbnail') === 'Y' ? true : false; + $config->video_mp4_gif_time = intval(Context::get('video_mp4_gif_time')); } // Check download grant $download_grant = Context::get('download_grant'); if(!is_array($download_grant)) { - $file_config->download_grant = explode('|@|',$download_grant); + $config->download_grant = explode('|@|',$download_grant); } else { - $file_config->download_grant = array_values($download_grant); + $config->download_grant = array_values($download_grant); } // Update $oModuleController = getController('module'); foreach(explode(',', Context::get('target_module_srl')) as $module_srl) { - $output = $oModuleController->insertModulePartConfig('file', trim($module_srl), $file_config); + $output = $oModuleController->insertModulePartConfig('file', trim($module_srl), $config); if(!$output->toBool()) { return $output; diff --git a/modules/file/file.controller.php b/modules/file/file.controller.php index 90bff8af2..97fbc79b8 100644 --- a/modules/file/file.controller.php +++ b/modules/file/file.controller.php @@ -1091,6 +1091,7 @@ class fileController extends file $file_info['height'] = $image_info['height']; // Set base information + $force = false; $adjusted = [ 'width' => $image_info['width'], 'height' => $image_info['height'], @@ -1141,7 +1142,6 @@ class fileController extends file $adjusted['rotate'] = $rotate; } } - unset($exif); } // Adjust image size @@ -1191,8 +1191,22 @@ class fileController extends file } } + // Set force for remove EXIF data + if($config->image_remove_exif_data && $image_info['type'] === 'jpg' && function_exists('exif_read_data')) + { + if(!isset($exif)) + { + $exif = @exif_read_data($file_info['tmp_name']); + } + if($exif && (isset($exif['Model']) || isset($exif['Software']) || isset($exif['GPSVersion']))) + { + $force = true; + } + } + // Convert image if adjusted if ( + $force || $adjusted['width'] !== $image_info['width'] || $adjusted['height'] !== $image_info['height'] || $adjusted['type'] !== $image_info['type'] || @@ -1220,7 +1234,7 @@ class fileController extends file if ($result) { $thumbnail_name = $file_info['tmp_name'] . '.thumbnail.jpg'; - if (FileHandler::createImageFile($file_info['tmp_name'], $thumbnail_name, $adjusted['width'], $adjusted['height'], 'jpg')) + if (FileHandler::createImageFile($file_info['tmp_name'], $thumbnail_name, $adjusted['width'], $adjusted['height'], 'jpg', 'crop', $adjusted['quality'])) { $file_info['thumbnail'] = $thumbnail_name; } diff --git a/modules/file/lang/en.php b/modules/file/lang/en.php index f2a732050..ec203e106 100644 --- a/modules/file/lang/en.php +++ b/modules/file/lang/en.php @@ -87,9 +87,11 @@ $lang->max_image_size_action_block = 'If exceeded, block upload'; $lang->max_image_size_action_resize = 'If exceeded, resize automatically'; $lang->max_image_size_admin = 'Also apply to administrator'; $lang->image_quality_adjustment = 'Image Quality'; -$lang->about_image_quality_adjustment = 'adjust the quality of uploaded images.'; +$lang->about_image_quality_adjustment = 'adjust the quality of images that will is converted by other settings.
If set to more than 75% (Standard), the file size may be larger than the original.'; $lang->image_autorotate = 'Fix Image Rotation'; $lang->about_image_autorotate = 'correct images that are rotated by mobile devices.'; +$lang->image_remove_exif_data = 'Remove EXIF'; +$lang->about_image_remove_exif_data = 'remove EXIF data including camera, GPS information, and more in image file for privacy.
Even if this option is not used, EXIF ​​data may be removed when the image is converted by other settings.'; $lang->image_autoconv_gif2mp4 = 'Convert GIF'; $lang->about_image_autoconv_gif2mp4 = 'convert animated GIF images into MP4 videos to save storage and bandwidth.
Videos may not play properly in older browsers.'; $lang->video_thumbnail = 'Video Thumbnail'; diff --git a/modules/file/lang/ko.php b/modules/file/lang/ko.php index e92014d13..ace8d7242 100644 --- a/modules/file/lang/ko.php +++ b/modules/file/lang/ko.php @@ -88,9 +88,11 @@ $lang->max_image_size_action_block = '초과시 업로드 금지'; $lang->max_image_size_action_resize = '초과시 자동 크기 조정'; $lang->max_image_size_admin = '관리자에게도 적용'; $lang->image_quality_adjustment = '이미지 화질'; -$lang->about_image_quality_adjustment = '업로드된 이미지의 화질을 조정합니다.'; +$lang->about_image_quality_adjustment = '다른 설정에 의해 이미지가 변환될 경우 화질을 조정합니다.
75% (표준) 이상으로 설정시 오히려 원본보다 용량이 늘어날 수 있습니다.'; $lang->image_autorotate = '이미지 회전 수정'; $lang->about_image_autorotate = '모바일 기기 등에서 잘못 회전된 이미지를 바로잡습니다.'; +$lang->image_remove_exif_data = 'EXIF 제거'; +$lang->about_image_remove_exif_data = '프라이버시를 위해 이미지 파일에서 카메라, GPS 정보 등이 포함되어 있는 EXIF 데이터를 삭제합니다.
이 옵션을 사용하지 않아도 다른 설정에 의해 이미지가 변환될 경우에도 EXIF 데이터가 삭제될 수 있습니다.'; $lang->image_autoconv_gif2mp4 = 'GIF 변환'; $lang->about_image_autoconv_gif2mp4 = '움직이는 GIF 이미지를 MP4 동영상으로 변환하여 용량 및 트래픽을 절약합니다.
구형 브라우저에서는 동영상이 재생되지 않을 수도 있습니다.'; $lang->video_thumbnail = '동영상 섬네일'; diff --git a/modules/file/tpl/file_module_config.html b/modules/file/tpl/file_module_config.html index 180042f6a..c7b4555c3 100644 --- a/modules/file/tpl/file_module_config.html +++ b/modules/file/tpl/file_module_config.html @@ -94,7 +94,7 @@

{$lang->about_image_quality_adjustment}

@@ -115,6 +115,21 @@

{$lang->msg_cannot_use_exif}

+
+ +
+ + +

{$lang->about_image_remove_exif_data}

+

{$lang->msg_cannot_use_exif}

+
+
diff --git a/modules/file/tpl/upload_config.html b/modules/file/tpl/upload_config.html index aec9a9f84..336c59fdb 100644 --- a/modules/file/tpl/upload_config.html +++ b/modules/file/tpl/upload_config.html @@ -95,6 +95,21 @@

{$lang->msg_cannot_use_exif}

+
+ +
+ + +

{$lang->about_image_remove_exif_data}

+

{$lang->msg_cannot_use_exif}

+
+