1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 17:59:37 +02:00

Add ability to set video thumbnail/preview

This commit is contained in:
Chocobozzz 2018-02-13 18:17:05 +01:00
parent e883399fa6
commit ac81d1a06d
No known key found for this signature in database
GPG key ID: 583A612D890159BE
22 changed files with 454 additions and 143 deletions

View file

@ -0,0 +1,21 @@
import 'multer'
import * as sharp from 'sharp'
import { unlinkPromise } from './core-utils'
async function processImage (
physicalFile: Express.Multer.File,
destination: string,
newSize: { width: number, height: number }
) {
await sharp(physicalFile.path)
.resize(newSize.width, newSize.height)
.toFile(destination)
await unlinkPromise(physicalFile.path)
}
// ---------------------------------------------------------------------------
export {
processImage
}