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:
parent
94565d52bb
commit
e8bafea35b
21 changed files with 654 additions and 266 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue