02211712
This commit is contained in:
parent
92983baf52
commit
39e7bf74ac
|
@ -14,7 +14,7 @@ export class ImageProcessor extends BaseProcessor {
|
||||||
const { url } = resource;
|
const { url } = resource;
|
||||||
const filepath = getUploadFilePath(url);
|
const filepath = getUploadFilePath(url);
|
||||||
const originMeta = resource.meta as unknown as FileMetadata;
|
const originMeta = resource.meta as unknown as FileMetadata;
|
||||||
if (!originMeta.mimeType?.startsWith('image/')) {
|
if (!originMeta.filetype?.startsWith('image/')) {
|
||||||
this.logger.log(`Skipping non-image resource: ${resource.id}`);
|
this.logger.log(`Skipping non-image resource: ${resource.id}`);
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ export class VideoProcessor extends BaseProcessor {
|
||||||
);
|
);
|
||||||
|
|
||||||
const originMeta = resource.meta as unknown as FileMetadata;
|
const originMeta = resource.meta as unknown as FileMetadata;
|
||||||
if (!originMeta.mimeType?.startsWith('video/')) {
|
if (!originMeta.filetype?.startsWith('video/')) {
|
||||||
this.logger.log(`Skipping non-video resource: ${resource.id}`);
|
this.logger.log(`Skipping non-video resource: ${resource.id}`);
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ export interface ProcessResult {
|
||||||
|
|
||||||
export interface BaseMetadata {
|
export interface BaseMetadata {
|
||||||
size: number
|
size: number
|
||||||
mimeType: string
|
filetype: string
|
||||||
filename: string
|
filename: string
|
||||||
extension: string
|
extension: string
|
||||||
modifiedAt: Date
|
modifiedAt: Date
|
||||||
|
|
|
@ -16,7 +16,7 @@ export const uploader = async (
|
||||||
maxSizeMB: 0.8, // 最大文件大小(MB)
|
maxSizeMB: 0.8, // 最大文件大小(MB)
|
||||||
maxWidthOrHeight: 1920, // 最大宽高
|
maxWidthOrHeight: 1920, // 最大宽高
|
||||||
useWebWorker: true,
|
useWebWorker: true,
|
||||||
fileType: "image/webp", // 输出文件格式
|
filetype: "image/webp", // 输出文件格式
|
||||||
};
|
};
|
||||||
const compressedFile = await imageCompression(file, options);
|
const compressedFile = await imageCompression(file, options);
|
||||||
return new File([compressedFile], `${file.name.split(".")[0]}.webp`, {
|
return new File([compressedFile], `${file.name.split(".")[0]}.webp`, {
|
||||||
|
|
Loading…
Reference in New Issue