]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/image-utils.ts
Translated using Weblate (Kabyle)
[github/Chocobozzz/PeerTube.git] / server / helpers / image-utils.ts
index 9285c12fc59aa383de2b4135b1933347ff67cf59..6f6f8d4da379952698f2fee76e64f956d104d9e7 100644 (file)
@@ -1,9 +1,14 @@
 import { copy, readFile, remove, rename } from 'fs-extra'
 import * as Jimp from 'jimp'
 import { extname } from 'path'
+import { v4 as uuidv4 } from 'uuid'
 import { convertWebPToJPG, processGIF } from './ffmpeg-utils'
 import { logger } from './logger'
 
+function generateImageFilename (extension = '.jpg') {
+  return uuidv4() + extension
+}
+
 async function processImage (
   path: string,
   destination: string,
@@ -31,6 +36,7 @@ async function processImage (
 // ---------------------------------------------------------------------------
 
 export {
+  generateImageFilename,
   processImage
 }