From 776414814dd990914abe289c01f1f2a43709482a Mon Sep 17 00:00:00 2001 From: camjac251 Date: Mon, 1 Jun 2020 04:17:23 -0500 Subject: [PATCH] add user config option for thumbnail size --- config.sample.js | 3 ++- controllers/utilsController.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config.sample.js b/config.sample.js index f4c60c7..dd53e7e 100644 --- a/config.sample.js +++ b/config.sample.js @@ -418,7 +418,8 @@ module.exports = { generateThumbs: { image: true, video: false, - placeholder: null + placeholder: null, + size: 200 }, /* diff --git a/controllers/utilsController.js b/controllers/utilsController.js index 8cfa2a0..915e75f 100644 --- a/controllers/utilsController.js +++ b/controllers/utilsController.js @@ -222,8 +222,8 @@ self.generateThumbs = async (name, extname, force) => { // If image extension if (self.imageExts.includes(extname)) { const resizeOptions = { - width: 200, - height: 200, + width: ${config.uploads.generateThumbs.size}, + height: ${config.uploads.generateThumbs.size}, fit: 'contain', background: { r: 0, @@ -270,7 +270,7 @@ self.generateThumbs = async (name, extname, force) => { .outputOptions([ `-ss ${duration * 20 / 100}`, '-vframes 1', - '-vf scale=600:600:force_original_aspect_ratio=decrease' + `-vf scale=${config.uploads.generateThumbs.size}:${config.uploads.generateThumbs.size}:force_original_aspect_ratio=decrease` ]) .on('error', async error => { // Try to unlink thumbnail,