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, 5 insertions, 5 deletions
diff --git a/server/helpers/image-utils.ts b/server/helpers/image-utils.ts
index eeaef0f5d..bd81aa3ba 100644
--- a/server/helpers/image-utils.ts
+++ b/server/helpers/image-utils.ts
@@ -4,19 +4,19 @@ import { readFile, remove } from 'fs-extra'
4import { logger } from './logger' 4import { logger } from './logger'
5 5
6async function processImage ( 6async function processImage (
7 physicalFile: { path: string }, 7 path: string,
8 destination: string, 8 destination: string,
9 newSize: { width: number, height: number }, 9 newSize: { width: number, height: number },
10 keepOriginal = false 10 keepOriginal = false
11) { 11) {
12 if (physicalFile.path === destination) { 12 if (path === destination) {
13 throw new Error('Sharp needs an input path different that the output path.') 13 throw new Error('Sharp needs an input path different that the output path.')
14 } 14 }
15 15
16 logger.debug('Processing image %s to %s.', physicalFile.path, destination) 16 logger.debug('Processing image %s to %s.', path, destination)
17 17
18 // Avoid sharp cache 18 // Avoid sharp cache
19 const buf = await readFile(physicalFile.path) 19 const buf = await readFile(path)
20 const sharpInstance = sharp(buf) 20 const sharpInstance = sharp(buf)
21 21
22 await remove(destination) 22 await remove(destination)
@@ -25,7 +25,7 @@ async function processImage (
25 .resize(newSize.width, newSize.height) 25 .resize(newSize.width, newSize.height)
26 .toFile(destination) 26 .toFile(destination)
27 27
28 if (keepOriginal !== true) await remove(physicalFile.path) 28 if (keepOriginal !== true) await remove(path)
29} 29}
30 30
31// --------------------------------------------------------------------------- 31// ---------------------------------------------------------------------------