From efbaa24b3016732fcfd9b661bf98bf90d7e308eb Mon Sep 17 00:00:00 2001 From: Bobby Wibowo Date: Wed, 7 Feb 2018 13:32:26 +0700 Subject: [PATCH] Updates More experimental changes to compliment the previous commit. --- controllers/albumsController.js | 2 +- controllers/uploadController.js | 4 ++-- routes/album.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/controllers/albumsController.js b/controllers/albumsController.js index 2b27dfa..57bbc5c 100644 --- a/controllers/albumsController.js +++ b/controllers/albumsController.js @@ -117,7 +117,7 @@ albumsController.get = async (req, res, next) => { file.file = `${config.domain}/${file.name}` const ext = path.extname(file.name).toLowerCase() - if (utils.imageExtensions.includes(ext) || utils.videoExtensions.includes(ext)) { + if ((config.uploads.generateImageThumbnails && utils.imageExtensions.includes(ext)) || (config.uploads.generateVideoThumbnails && utils.videoExtensions.includes(ext))) { file.thumb = `${config.domain}/thumbs/${file.name.slice(0, -ext.length)}.png` } } diff --git a/controllers/uploadController.js b/controllers/uploadController.js index ee8cc19..1918897 100644 --- a/controllers/uploadController.js +++ b/controllers/uploadController.js @@ -146,7 +146,7 @@ uploadsController.processFilesForDisplay = async (req, res, files, existingFiles for (let file of files) { let ext = path.extname(file.name).toLowerCase() - if (utils.imageExtensions.includes(ext) || utils.videoExtensions.includes(ext)) { + if ((config.uploads.generateImageThumbnails && utils.imageExtensions.includes(ext)) || (config.uploads.generateVideoThumbnails && utils.videoExtensions.includes(ext))) { file.thumb = `${basedomain}/thumbs/${file.name.slice(0, -ext.length)}.png` utils.generateThumbs(file) } @@ -259,7 +259,7 @@ uploadsController.list = async (req, res) => { } let ext = path.extname(file.name).toLowerCase() - if (utils.imageExtensions.includes(ext) || utils.videoExtensions.includes(ext)) { + if ((config.uploads.generateImageThumbnails && utils.imageExtensions.includes(ext)) || (config.uploads.generateVideoThumbnails && utils.videoExtensions.includes(ext))) { file.thumb = `${basedomain}/thumbs/${file.name.slice(0, -ext.length)}.png` } } diff --git a/routes/album.js b/routes/album.js index 56d2211..f3c068d 100644 --- a/routes/album.js +++ b/routes/album.js @@ -19,7 +19,7 @@ routes.get('/a/:identifier', async (req, res, next) => { file.file = `${basedomain}/${file.name}` let ext = path.extname(file.name).toLowerCase() - if (utils.imageExtensions.includes(ext) || utils.videoExtensions.includes(ext)) { + if ((config.uploads.generateImageThumbnails && utils.imageExtensions.includes(ext)) || (config.uploads.generateVideoThumbnails && utils.videoExtensions.includes(ext))) { file.thumb = `${basedomain}/thumbs/${file.name.slice(0, -ext.length)}.png` /*