Commit a973b0c1 authored by A. Koch's avatar A. Koch

add more thumbnail versions, update media dependency

parent b52cd68d
Pipeline #1048 passed with stage
......@@ -2667,9 +2667,9 @@
}
},
"mbjs-media": {
"version": "0.0.25",
"resolved": "https://registry.npmjs.org/mbjs-media/-/mbjs-media-0.0.25.tgz",
"integrity": "sha512-J4404To/C/2FA4UviDwz/5EYpbbz/3vNsMLj8FweqpoVtWopqBUxrDUvx5AtiE9AYY8138CFL6I2KF71ERaKpQ==",
"version": "0.0.27",
"resolved": "https://registry.npmjs.org/mbjs-media/-/mbjs-media-0.0.27.tgz",
"integrity": "sha512-uT2qDlKqtCEzHtb/4gO6hOQ7rpRnjtYHNvfJBOeHTiUa8XFoe1fb/gKFdXxA9inqAWPLUAa3VqwMQEeLraTbMg==",
"requires": {
"axios": "^0.18.0",
"bluebird": "^3.5.1",
......
......@@ -59,13 +59,23 @@ const convertJob = async function (job) {
await ffmpegThumb(destination, tmpDir, 1, progress => {
job.progress(60 + progress.percent * 0.3)
})
let thumbFile = `${baseName}.jpg`
let thumbPath = path.join(path.dirname(destination), thumbFile)
const thumbFile = `${baseName}.jpg`
const thumbPath = path.join(path.dirname(destination), thumbFile)
await image.convert(path.join(tmpDir, 'tn.png'), thumbPath)
const thumbFileSmall = `${baseName}-s.jpg`
const thumbPathSmall = path.join(path.dirname(destination), thumbFileSmall)
await image.convert(path.join(tmpDir, 'tn.png'), thumbPathSmall, { resize: { width: 240, height: 240 } })
const thumbFileMedium = `${baseName}-m.jpg`
const thumbPathMedium = path.join(path.dirname(destination), thumbFileMedium)
await image.convert(path.join(tmpDir, 'tn.png'), thumbPathMedium, { resize: { width: 640, height: 640 } })
const minioClient = new Minio.Client(config.assets.client)
await minioClient.fPutObject(config.assets.bucket, destFile, destination, { 'Content-Type': 'video/mp4' })
await minioClient.fPutObject(config.assets.bucket, thumbFile, thumbPath, { 'Content-Type': 'image/png' })
await minioClient.fPutObject(config.assets.bucket, thumbFile, thumbPath, { 'Content-Type': 'image/jpg' })
await minioClient.fPutObject(config.assets.bucket, thumbFileSmall, thumbPathSmall, { 'Content-Type': 'image/jpg' })
await minioClient.fPutObject(config.assets.bucket, thumbFileMedium, thumbPathMedium, { 'Content-Type': 'image/jpg' })
await fs.remove(tmpDir)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment