dont save relative_path in db for group covers
This commit is contained in:
Barış Soner Uşaklı
2018-12-18 19:43:28 -05:00
parent 29a85aecc7
commit 7e828404f6
11 changed files with 66 additions and 79 deletions

View File

@@ -139,3 +139,28 @@ image.writeImageDataToTempFile = function (imageData, callback) {
image.sizeFromBase64 = function (imageData) {
return Buffer.from(imageData.slice(imageData.indexOf('base64') + 7), 'base64').length;
};
image.uploadImage = function (filename, folder, image, callback) {
if (plugins.hasListeners('filter:uploadImage')) {
return plugins.fireHook('filter:uploadImage', {
image: image,
uid: image.uid,
}, callback);
}
async.waterfall([
function (next) {
file.isFileTypeAllowed(image.path, next);
},
function (next) {
file.saveFileToLocal(filename, folder, image.path, next);
},
function (upload, next) {
next(null, {
url: upload.url,
path: upload.path,
name: image.name,
});
},
], callback);
};