1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Create a dedicated table to track video thumbnails

This commit is contained in:
Chocobozzz 2019-04-17 10:07:00 +02:00
parent 94565d52bb
commit e8bafea35b
No known key found for this signature in database
GPG key ID: 583A612D890159BE
21 changed files with 654 additions and 266 deletions

View file

@ -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)
}
// ---------------------------------------------------------------------------