diff options
Diffstat (limited to 'server/helpers/image-utils.ts')
-rw-r--r-- | server/helpers/image-utils.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/server/helpers/image-utils.ts b/server/helpers/image-utils.ts index 5f254a7aa..fdf06e848 100644 --- a/server/helpers/image-utils.ts +++ b/server/helpers/image-utils.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { extname } from 'path' | ||
1 | import { remove, rename } from 'fs-extra' | 2 | import { remove, rename } from 'fs-extra' |
2 | import { convertWebPToJPG } from './ffmpeg-utils' | 3 | import { convertWebPToJPG, processGIF } from './ffmpeg-utils' |
3 | import { logger } from './logger' | 4 | import { logger } from './logger' |
4 | 5 | ||
5 | const Jimp = require('jimp') | 6 | const Jimp = require('jimp') |
@@ -10,6 +11,13 @@ async function processImage ( | |||
10 | newSize: { width: number, height: number }, | 11 | newSize: { width: number, height: number }, |
11 | keepOriginal = false | 12 | keepOriginal = false |
12 | ) { | 13 | ) { |
14 | const extension = extname(path) | ||
15 | |||
16 | // Use FFmpeg to process GIF | ||
17 | if (extension === '.gif') { | ||
18 | return processGIF(path, destination, newSize, keepOriginal) | ||
19 | } | ||
20 | |||
13 | if (path === destination) { | 21 | if (path === destination) { |
14 | throw new Error('Jimp needs an input path different that the output path.') | 22 | throw new Error('Jimp needs an input path different that the output path.') |
15 | } | 23 | } |