aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/image-utils.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-17 10:07:00 +0200
committerChocobozzz <me@florianbigard.com>2019-04-24 16:25:52 +0200
commite8bafea35bc930cb8ac5b2d521a188642a1adffe (patch)
tree7537f957ed7307b464e3c90b71b813d992acaade /server/helpers/image-utils.ts
parent94565d52bb2883e09f16d1363170ac9c0dccb7a1 (diff)
downloadPeerTube-e8bafea35bc930cb8ac5b2d521a188642a1adffe.tar.gz
PeerTube-e8bafea35bc930cb8ac5b2d521a188642a1adffe.tar.zst
PeerTube-e8bafea35bc930cb8ac5b2d521a188642a1adffe.zip
Create a dedicated table to track video thumbnails
Diffstat (limited to 'server/helpers/image-utils.ts')
-rw-r--r--server/helpers/image-utils.ts5
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'
6async function processImage ( 6async 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// ---------------------------------------------------------------------------