Major rework of media handelling, and collections
This commit is contained in:
1 parent
b42e055691
commit
f7cb2bed53
37 files changed
+1120
-411
No files matched your search
@@ -12,8 +12,7 @@ const entryPicturesUpload = multer({
|
||||
if (file.fieldname == 'backdrop') folder = 'backdrops';
|
||||
if (file.fieldname == 'logo') folder = 'logos';
|
||||
|
||||
const settings = getSettings();
|
||||
const dataPath = settings.userDataPath;
|
||||
const dataPath = getSettings().userDataPath;
|
||||
|
||||
cb(null, path.join(dataPath, 'images', 'entries', folder));
|
||||
},
|
||||
@@ -25,7 +24,27 @@ const entryPicturesUpload = multer({
|
||||
})
|
||||
});
|
||||
|
||||
const collectionPicturesUpload = multer({
|
||||
storage:
|
||||
multer.diskStorage({
|
||||
destination: function (req, file, cb) {
|
||||
let folder = 'posters';
|
||||
if (file.fieldname == 'backdrop') folder = 'backdrops';
|
||||
if (file.fieldname == 'logo') folder = 'logos';
|
||||
|
||||
const dataPath = getSettings().userDataPath;
|
||||
|
||||
cb(null, path.join(dataPath, 'images', 'collections', folder));
|
||||
},
|
||||
filename: function (req, file, cb) {
|
||||
const uniqueFilename = uuidv4();
|
||||
const extension = file.originalname.split('.').pop();
|
||||
cb(null, `${uniqueFilename}.${extension}`);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
entryPicturesUpload,
|
||||
collectionPicturesUpload,
|
||||
}
|
||||
Reference in new issue
Block a user