From e8bafea35bc930cb8ac5b2d521a188642a1adffe Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 17 Apr 2019 10:07:00 +0200 Subject: Create a dedicated table to track video thumbnails --- server/helpers/image-utils.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'server/helpers') 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' async function processImage ( physicalFile: { path: string }, destination: string, - newSize: { width: number, height: number } + newSize: { width: number, height: number }, + keepOriginal = false ) { if (physicalFile.path === destination) { throw new Error('Sharp needs an input path different that the output path.') @@ -24,7 +25,7 @@ async function processImage ( .resize(newSize.width, newSize.height) .toFile(destination) - await remove(physicalFile.path) + if (keepOriginal !== true) await remove(physicalFile.path) } // --------------------------------------------------------------------------- -- cgit v1.2.3