diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-05-15 21:27:20 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-05-15 21:27:20 +0900 |
| commit | 3d8bbedf1bbd501d3ad5e3c26e5e5005ed2d8371 (patch) | |
| tree | fab0aef7b9bc928980e1788cf55867aacd14abb7 /src/services/drive/add-file.ts | |
| parent | Resolve #4833 (diff) | |
| download | misskey-3d8bbedf1bbd501d3ad5e3c26e5e5005ed2d8371.tar.gz misskey-3d8bbedf1bbd501d3ad5e3c26e5e5005ed2d8371.tar.bz2 misskey-3d8bbedf1bbd501d3ad5e3c26e5e5005ed2d8371.zip | |
GIFのサムネイルが生成されないのを修正
#4728
Diffstat (limited to 'src/services/drive/add-file.ts')
| -rw-r--r-- | src/services/drive/add-file.ts | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/services/drive/add-file.ts b/src/services/drive/add-file.ts index c67ee475a8..949089eded 100644 --- a/src/services/drive/add-file.ts +++ b/src/services/drive/add-file.ts @@ -12,7 +12,7 @@ import config from '../../config'; import { fetchMeta } from '../../misc/fetch-meta'; import { GenerateVideoThumbnail } from './generate-video-thumbnail'; import { driveLogger } from './logger'; -import { IImage, ConvertToJpeg, ConvertToWebp, ConvertToPng } from './image-processor'; +import { IImage, convertToJpeg, convertToWebp, convertToPng, convertToGif, convertToApng } from './image-processor'; import { contentDisposition } from '../../misc/content-disposition'; import { detectMine } from '../../misc/detect-mine'; import { DriveFiles, DriveFolders, Users, Instances, UserProfiles } from '../../models'; @@ -149,11 +149,15 @@ export async function generateAlts(path: string, type: string, generateWeb: bool logger.info(`creating web image`); if (['image/jpeg'].includes(type)) { - webpublic = await ConvertToJpeg(path, 2048, 2048); + webpublic = await convertToJpeg(path, 2048, 2048); } else if (['image/webp'].includes(type)) { - webpublic = await ConvertToWebp(path, 2048, 2048); + webpublic = await convertToWebp(path, 2048, 2048); } else if (['image/png'].includes(type)) { - webpublic = await ConvertToPng(path, 2048, 2048); + webpublic = await convertToPng(path, 2048, 2048); + } else if (['image/apng', 'image/vnd.mozilla.apng'].includes(type)) { + webpublic = await convertToApng(path); + } else if (['image/gif'].includes(type)) { + webpublic = await convertToGif(path); } else { logger.info(`web image not created (not an image)`); } @@ -166,9 +170,11 @@ export async function generateAlts(path: string, type: string, generateWeb: bool let thumbnail: IImage | null = null; if (['image/jpeg', 'image/webp'].includes(type)) { - thumbnail = await ConvertToJpeg(path, 498, 280); + thumbnail = await convertToJpeg(path, 498, 280); } else if (['image/png'].includes(type)) { - thumbnail = await ConvertToPng(path, 498, 280); + thumbnail = await convertToPng(path, 498, 280); + } else if (['image/gif'].includes(type)) { + thumbnail = await convertToGif(path); } else if (type.startsWith('video/')) { try { thumbnail = await GenerateVideoThumbnail(path); |