aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/image-utils.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-04-08 11:23:45 +0200
committerChocobozzz <me@florianbigard.com>2021-04-08 13:38:04 +0200
commit84531547bc0934a2abda586d539f7455b455d488 (patch)
tree128bf5f3a7f57e4e2f343d5da574a4e002163736 /server/helpers/image-utils.ts
parenta0eeb45f14bab539f505861cad8f5d42d9ba30cb (diff)
downloadPeerTube-84531547bc0934a2abda586d539f7455b455d488.tar.gz
PeerTube-84531547bc0934a2abda586d539f7455b455d488.tar.zst
PeerTube-84531547bc0934a2abda586d539f7455b455d488.zip
Add size info in db for actor images
Diffstat (limited to 'server/helpers/image-utils.ts')
-rw-r--r--server/helpers/image-utils.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/server/helpers/image-utils.ts b/server/helpers/image-utils.ts
index 9285c12fc..6f6f8d4da 100644
--- a/server/helpers/image-utils.ts
+++ b/server/helpers/image-utils.ts
@@ -1,9 +1,14 @@
1import { copy, readFile, remove, rename } from 'fs-extra' 1import { copy, readFile, remove, rename } from 'fs-extra'
2import * as Jimp from 'jimp' 2import * as Jimp from 'jimp'
3import { extname } from 'path' 3import { extname } from 'path'
4import { v4 as uuidv4 } from 'uuid'
4import { convertWebPToJPG, processGIF } from './ffmpeg-utils' 5import { convertWebPToJPG, processGIF } from './ffmpeg-utils'
5import { logger } from './logger' 6import { logger } from './logger'
6 7
8function generateImageFilename (extension = '.jpg') {
9 return uuidv4() + extension
10}
11
7async function processImage ( 12async function processImage (
8 path: string, 13 path: string,
9 destination: string, 14 destination: string,
@@ -31,6 +36,7 @@ async function processImage (
31// --------------------------------------------------------------------------- 36// ---------------------------------------------------------------------------
32 37
33export { 38export {
39 generateImageFilename,
34 processImage 40 processImage
35} 41}
36 42