From 49203c15a7de5050054d3d4d6f0d94c727d903c6 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Mon, 3 Jun 2024 11:32:12 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=92=AD=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Module/Base.php | 15 +++- docker-compose.yml | 2 +- .../PreviewImage/components/video.vue | 74 +++++++++++++++++++ .../js/components/PreviewImage/index.vue | 17 ++++- .../js/components/PreviewImage/state.vue | 10 +++ .../js/pages/manage/components/DialogView.vue | 29 +++++++- .../pages/manage/components/DialogWrapper.vue | 8 ++ resources/assets/js/store/actions.js | 2 +- .../sass/pages/components/dialog-wrapper.scss | 42 +++++++++++ 9 files changed, 191 insertions(+), 8 deletions(-) create mode 100644 resources/assets/js/components/PreviewImage/components/video.vue diff --git a/app/Module/Base.php b/app/Module/Base.php index ef5909df4..2e4a47bd6 100755 --- a/app/Module/Base.php +++ b/app/Module/Base.php @@ -2218,7 +2218,7 @@ public static function upload($param) $type = ['jpg', 'jpeg', 'webp', 'gif', 'png']; break; case 'video': - $type = ['rm', 'rmvb', 'wmv', 'avi', 'mpg', 'mpeg', 'mp4']; + $type = ['rm', 'rmvb', 'wmv', 'avi', 'mpg', 'mpeg', 'mp4', 'webm']; break; case 'audio': $type = ['mp3', 'wma', 'wav', 'amr']; @@ -2233,7 +2233,7 @@ public static function upload($param) $type = ['zip']; break; case 'file': - $type = ['jpg', 'jpeg', 'webp', 'png', 'gif', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'esp', 'pdf', 'rar', 'zip', 'gz', 'ai', 'avi', 'bmp', 'cdr', 'eps', 'mov', 'mp3', 'mp4', 'pr', 'psd', 'svg', 'tif']; + $type = ['jpg', 'jpeg', 'webp', 'png', 'gif', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'esp', 'pdf', 'rar', 'zip', 'gz', 'ai', 'avi', 'bmp', 'cdr', 'eps', 'mov', 'mp3', 'mp4', 'webm', 'pr', 'psd', 'svg', 'tif']; break; case 'firmware': $type = ['img', 'tar', 'bin']; @@ -2320,6 +2320,17 @@ public static function upload($param) } } // + if (in_array($extension, ['mp4', 'webm'])) { + // 视频尺寸 + $thumbFile = $array['file'] . '_thumb.jpg'; + shell_exec("ffmpeg -i {$array['file']} -ss 1 -vframes 1 {$thumbFile} 2>&1"); + if (file_exists($thumbFile)) { + $paramet = getimagesize($thumbFile); + $array['width'] = $paramet[0]; + $array['height'] = $paramet[1]; + $array['thumb'] = $array['path'] . '_thumb.jpg'; + } + } if (in_array($extension, ['jpg', 'jpeg', 'webp', 'gif', 'png'])) { //图片尺寸 $paramet = getimagesize($array['file']); diff --git a/docker-compose.yml b/docker-compose.yml index 9abb7cbc9..5fedf5610 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: php: container_name: "dootask-php-${APP_ID}" - image: "kuaifan/php:swoole-8.0.rc14" + image: "kuaifan/php:swoole-8.0.rc15" shm_size: "2gb" ulimits: core: diff --git a/resources/assets/js/components/PreviewImage/components/video.vue b/resources/assets/js/components/PreviewImage/components/video.vue new file mode 100644 index 000000000..cfa1ab8c8 --- /dev/null +++ b/resources/assets/js/components/PreviewImage/components/video.vue @@ -0,0 +1,74 @@ + + + + + diff --git a/resources/assets/js/components/PreviewImage/index.vue b/resources/assets/js/components/PreviewImage/index.vue index ba2f84443..dda13abcc 100644 --- a/resources/assets/js/components/PreviewImage/index.vue +++ b/resources/assets/js/components/PreviewImage/index.vue @@ -8,8 +8,9 @@ :class-name="viewMode === 'desktop' ? 'common-preview-image-view' : 'common-preview-image-swipe'" fullscreen> @@ -64,12 +65,13 @@ body {