サムネイルをJPEGで生成するように (#5941)
This commit is contained in:
parent
962617b4f4
commit
439563c5d6
3 changed files with 39 additions and 7 deletions
|
@ -9,7 +9,7 @@ import { DriveFiles } from '../../models';
|
|||
import { InternalStorage } from '../../services/drive/internal-storage';
|
||||
import { downloadUrl } from '../../misc/donwload-url';
|
||||
import { detectType } from '../../misc/get-file-info';
|
||||
import { convertToJpeg, convertToPng } from '../../services/drive/image-processor';
|
||||
import { convertToJpeg, convertToPngOrJpeg } from '../../services/drive/image-processor';
|
||||
import { GenerateVideoThumbnail } from '../../services/drive/generate-video-thumbnail';
|
||||
|
||||
const assets = `${__dirname}/../../server/file/assets/`;
|
||||
|
@ -59,7 +59,7 @@ export default async function(ctx: Koa.Context) {
|
|||
if (['image/jpeg', 'image/webp'].includes(mime)) {
|
||||
return await convertToJpeg(path, 498, 280);
|
||||
} else if (['image/png'].includes(mime)) {
|
||||
return await convertToPng(path, 498, 280);
|
||||
return await convertToPngOrJpeg(path, 498, 280);
|
||||
} else if (mime.startsWith('video/')) {
|
||||
return await GenerateVideoThumbnail(path);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue