diff options
Diffstat (limited to 'server/helpers/image-utils.ts')
-rw-r--r-- | server/helpers/image-utils.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/server/helpers/image-utils.ts b/server/helpers/image-utils.ts index e43ea3f1d..eeaef0f5d 100644 --- a/server/helpers/image-utils.ts +++ b/server/helpers/image-utils.ts | |||
@@ -6,7 +6,8 @@ import { logger } from './logger' | |||
6 | async function processImage ( | 6 | async function processImage ( |
7 | physicalFile: { path: string }, | 7 | physicalFile: { path: string }, |
8 | destination: string, | 8 | destination: string, |
9 | newSize: { width: number, height: number } | 9 | newSize: { width: number, height: number }, |
10 | keepOriginal = false | ||
10 | ) { | 11 | ) { |
11 | if (physicalFile.path === destination) { | 12 | if (physicalFile.path === destination) { |
12 | 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.') |
@@ -24,7 +25,7 @@ async function processImage ( | |||
24 | .resize(newSize.width, newSize.height) | 25 | .resize(newSize.width, newSize.height) |
25 | .toFile(destination) | 26 | .toFile(destination) |
26 | 27 | ||
27 | await remove(physicalFile.path) | 28 | if (keepOriginal !== true) await remove(physicalFile.path) |
28 | } | 29 | } |
29 | 30 | ||
30 | // --------------------------------------------------------------------------- | 31 | // --------------------------------------------------------------------------- |