aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/image-utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/image-utils.ts')
-rw-r--r--server/helpers/image-utils.ts10
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 @@
1import { extname } from 'path'
1import { remove, rename } from 'fs-extra' 2import { remove, rename } from 'fs-extra'
2import { convertWebPToJPG } from './ffmpeg-utils' 3import { convertWebPToJPG, processGIF } from './ffmpeg-utils'
3import { logger } from './logger' 4import { logger } from './logger'
4 5
5const Jimp = require('jimp') 6const 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 }