From 200138350bac8a5939e1be4e1ef3f0be70059acd Mon Sep 17 00:00:00 2001 From: chenos Date: Fri, 13 Oct 2023 19:49:51 +0800 Subject: [PATCH] fix(file-manager): improve default values for thumbnail rules --- .../client/src/schema-component/antd/upload/ReadPretty.tsx | 2 +- .../src/client/schemas/storageTypes/ali-oss.ts | 3 ++- .../@nocobase/plugin-file-manager/src/server/FileModel.ts | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/upload/ReadPretty.tsx b/packages/core/client/src/schema-component/antd/upload/ReadPretty.tsx index 5e2d8b1812..1ce4e7d795 100644 --- a/packages/core/client/src/schema-component/antd/upload/ReadPretty.tsx +++ b/packages/core/client/src/schema-component/antd/upload/ReadPretty.tsx @@ -95,7 +95,7 @@ ReadPretty.File = function File(props: UploadProps) { > {file.imageUrl && ( {file.title} diff --git a/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/ali-oss.ts b/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/ali-oss.ts index c6e7e05b47..b35e299c93 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/ali-oss.ts +++ b/packages/plugins/@nocobase/plugin-file-manager/src/client/schemas/storageTypes/ali-oss.ts @@ -56,8 +56,9 @@ export default { 'x-decorator': 'FormItem', 'x-component': 'Input', 'x-component-props': { - placeholder: '?x-oss-process=image/auto-orient,1/resize,m_fill,w_40,h_40/quality,q_90', + placeholder: '?x-oss-process=image/auto-orient,1/resize,m_fill,w_94,h_94/quality,q_90', }, + default: '?x-oss-process=image/auto-orient,1/resize,m_fill,w_94,h_94/quality,q_90', description: '{{ xStyleProcessDesc }}', }, }, diff --git a/packages/plugins/@nocobase/plugin-file-manager/src/server/FileModel.ts b/packages/plugins/@nocobase/plugin-file-manager/src/server/FileModel.ts index 27be26b1f9..748a41b322 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/src/server/FileModel.ts +++ b/packages/plugins/@nocobase/plugin-file-manager/src/server/FileModel.ts @@ -7,6 +7,9 @@ export class FileModel extends Model { if (json.storageId && fileStorages && fileStorages.has(json.storageId)) { const storage = fileStorages.get(json.storageId); json['thumbnailRule'] = storage?.options?.thumbnailRule; + if (!json['thumbnailRule'] && storage?.type === 'ali-oss') { + json['thumbnailRule'] = '?x-oss-process=image/auto-orient,1/resize,m_fill,w_94,h_94/quality,q_90'; + } } return json; }