diff --git a/modules/file/file.admin.controller.php b/modules/file/file.admin.controller.php index 27048bdf1..759658df2 100644 --- a/modules/file/file.admin.controller.php +++ b/modules/file/file.admin.controller.php @@ -240,14 +240,21 @@ class FileAdminController extends File if(!Context::get('use_image_default_file_config')) { $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; + foreach (Context::get('image_autoconv') ?: [] as $source_type => $target_type) + { + if (in_array($target_type, ['Y', 'N'])) + { + $config->image_autoconv[$source_type] = tobool($target_type); + } + elseif (in_array($target_type, ['', 'jpg', 'png', 'webp'])) + { + $config->image_autoconv[$source_type] = $target_type; + } + } $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_same_format = Context::get('max_image_size_same_format') === 'Y' ? 'Y' : 'N'; + $config->max_image_size_same_format = strval(Context::get('max_image_size_same_format')); $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; diff --git a/modules/file/file.view.php b/modules/file/file.view.php index 8aeb3f296..8f58f7eee 100644 --- a/modules/file/file.view.php +++ b/modules/file/file.view.php @@ -36,8 +36,21 @@ class FileView extends File // Get file configurations of the module $config = FileModel::getFileConfig($current_module_srl); + if (!isset($config->use_default_file_config)) + { + $config->use_default_file_config = 'Y'; + } + if (!isset($config->use_image_default_file_config)) + { + $config->use_image_default_file_config = 'Y'; + } + if (!isset($config->use_video_default_file_config)) + { + $config->use_video_default_file_config = 'Y'; + } Context::set('config', $config); - Context::set('is_ffmpeg', function_exists('exec') && Rhymix\Framework\Storage::isExecutable($config->ffmpeg_command) && Rhymix\Framework\Storage::isExecutable($config->ffprobe_command)); + Context::set('is_ffmpeg', function_exists('exec') && !empty($config->ffmpeg_command) && Rhymix\Framework\Storage::isExecutable($config->ffmpeg_command) && !empty($config->ffprobe_command) && Rhymix\Framework\Storage::isExecutable($config->ffprobe_command)); + Context::set('is_magick', function_exists('exec') && !empty($config->magick_command) && Rhymix\Framework\Storage::isExecutable($config->magick_command)); // Get a permission for group setting $group_list = MemberModel::getGroups(); diff --git a/modules/file/tpl/file_module_config.html b/modules/file/tpl/file_module_config.html index 537bb99e9..104580fb8 100644 --- a/modules/file/tpl/file_module_config.html +++ b/modules/file/tpl/file_module_config.html @@ -55,19 +55,24 @@
- - - -

{$lang->about_image_autoconv}

+ {@ $source_types = ['bmp', 'jpg', 'png', 'webp', 'avif', 'heic']} + +
+ → + +
+ +

+ {$lang->about_image_autoconv}
+ {$lang->msg_need_magick} +

@@ -85,12 +90,16 @@

-

{$lang->about_image_autoconv_gif2mp4}