From 0071d3f2dcc20a4b371ae34104b6c26544bb584a Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Wed, 24 May 2023 13:23:00 +0900 Subject: [PATCH] Add options to limit video duration --- modules/file/file.admin.controller.php | 3 +++ modules/file/lang/en.php | 2 ++ modules/file/lang/ko.php | 4 ++++ modules/file/tpl/upload_config.html | 20 ++++++++++++++++++++ 4 files changed, 29 insertions(+) diff --git a/modules/file/file.admin.controller.php b/modules/file/file.admin.controller.php index 3686f77aa..df7b68813 100644 --- a/modules/file/file.admin.controller.php +++ b/modules/file/file.admin.controller.php @@ -90,6 +90,9 @@ class FileAdminController extends File $config->max_video_height = intval(Context::get('max_video_height')) ?: ''; $config->max_video_size_action = Context::get('max_video_size_action') ?: ''; $config->max_video_size_admin = Context::get('max_video_size_admin') === 'Y' ? 'Y' : 'N'; + $config->max_video_duration = intval(Context::get('max_video_duration')) ?: ''; + $config->max_video_duration_action = Context::get('max_video_duration_action') ?: ''; + $config->max_video_duration_admin = Context::get('max_video_duration_admin') === 'Y' ? 'Y' : 'N'; $config->video_autoconv['any2mp4'] = Context::get('video_autoconv_any2mp4') === 'Y' ? true : false; $config->video_always_reencode = Context::get('video_always_reencode') === 'Y' ? true : false; $config->video_thumbnail = Context::get('video_thumbnail') === 'Y' ? true : false; diff --git a/modules/file/lang/en.php b/modules/file/lang/en.php index fab3c0640..10c1d078d 100644 --- a/modules/file/lang/en.php +++ b/modules/file/lang/en.php @@ -57,6 +57,7 @@ $lang->msg_exceeds_max_image_height = 'This image is too large. The maximum perm $lang->msg_exceeds_max_video_size = 'This video is too large. Videos must be no larger than %dx%dpx.'; $lang->msg_exceeds_max_video_width = 'This video is too large. The maximum permitted width is %dpx.'; $lang->msg_exceeds_max_video_height = 'This video is too large. The maximum permitted height is %dpx.'; +$lang->msg_exceeds_max_video_duration = 'This video is too long. The maximum permitted duration is %d seconds.'; $lang->msg_file_not_found = 'Could not find requested file.'; $lang->msg_file_key_expired = 'This download link is expired. Please initiate the download again.'; $lang->file_search_target_list['filename'] = 'File Name'; @@ -94,6 +95,7 @@ $lang->about_max_image_size = 'Limit the dimensions of uploaded images. Note tha $lang->max_image_size_action_nothing = 'If exceeded, do nothing'; $lang->max_image_size_action_block = 'If exceeded, block upload'; $lang->max_image_size_action_resize = 'If exceeded, resize automatically'; +$lang->max_image_size_action_cut = 'If exceeded, cut automatically'; $lang->max_image_size_same_format_Y = 'Maintain file format'; $lang->max_image_size_same_format_N = 'Convert to JPG'; $lang->max_image_size_admin = 'Also apply to administrator'; diff --git a/modules/file/lang/ko.php b/modules/file/lang/ko.php index 0d2b0f96c..adfe6385d 100644 --- a/modules/file/lang/ko.php +++ b/modules/file/lang/ko.php @@ -58,6 +58,7 @@ $lang->msg_exceeds_max_image_height = '이미지가 너무 큽니다. 높이 %dp $lang->msg_exceeds_max_video_size = '동영상이 너무 큽니다. %dx%dpx 이하의 동영상만 허용됩니다.'; $lang->msg_exceeds_max_video_width = '동영상이 너무 큽니다. 폭 %dpx 이하의 동영상만 허용됩니다.'; $lang->msg_exceeds_max_video_height = '동영상이 너무 큽니다. 높이 %dpx 이하의 동영상만 허용됩니다.'; +$lang->msg_exceeds_max_video_duration = '동영상이 너무 깁니다. %d초 이하의 동영상만 허용됩니다.'; $lang->msg_file_not_found = '요청한 파일을 찾을 수 없습니다.'; $lang->msg_file_key_expired = '다운로드 링크의 유효기간이 지났습니다. 다시 다운로드하여 주시기 바랍니다.'; $lang->file_search_target_list['filename'] = '파일 이름'; @@ -95,6 +96,7 @@ $lang->about_max_image_size = '업로드된 이미지의 크기를 제한하거 $lang->max_image_size_action_nothing = '초과시 아무 것도 하지 않음'; $lang->max_image_size_action_block = '초과시 업로드 금지'; $lang->max_image_size_action_resize = '초과시 자동 크기 조정'; +$lang->max_image_size_action_cut = '초과시 자르기'; $lang->max_image_size_same_format_Y = '동일한 포맷 유지'; $lang->max_image_size_same_format_N = 'JPG로 변환'; $lang->max_image_size_admin = '관리자에게도 적용'; @@ -108,6 +110,8 @@ $lang->image_autoconv_gif2mp4 = 'GIF → MP4 변환'; $lang->about_image_autoconv_gif2mp4 = '움직이는 GIF 이미지를 MP4 동영상으로 변환하여 용량 및 트래픽을 절약합니다.
아래에서 ffmpeg 설정을 해야 하며, 구형 브라우저에서는 동영상이 재생되지 않을 수도 있습니다.'; $lang->max_video_size = '동영상 크기 제한'; $lang->about_max_video_size = '업로드된 동영상의 크기를 제한하거나 조정합니다. 파일 용량과는 직접적인 관계가 없으니 참고하세요.'; +$lang->max_video_duration = '동영상 길이 제한'; +$lang->about_max_video_duration = '업로드된 동영상의 재생 시간을 제한하거나 조정합니다. 파일 용량과는 직접적인 관계가 없으니 참고하세요.'; $lang->video_autoconv_any2mp4 = 'MP4로 변환'; $lang->about_video_autoconv_any2mp4 = 'MP4 이외의 동영상 포맷은 모두 웹에서 재생할 수 있는 MP4 포맷으로 변환합니다.
지원하는 원본 포맷은 ffmpeg 버전 및 서버 환경에 따라 다르지만 일반적으로 AVI, MOV 등이 해당됩니다.'; $lang->video_always_reencode = '무조건 재인코딩'; diff --git a/modules/file/tpl/upload_config.html b/modules/file/tpl/upload_config.html index 3598101ba..316d32047 100644 --- a/modules/file/tpl/upload_config.html +++ b/modules/file/tpl/upload_config.html @@ -159,6 +159,26 @@

+
+ +
+ {$lang->unit_sec}   + +

+ {$lang->about_max_video_duration} +

+

+ +

+
+