upload changes, just pass filename to plugin or base64 data

v1.18.x
Baris Soner Usakli 11 years ago
parent daa76e821c
commit 2c18bbddbe

@ -397,7 +397,7 @@ var db = require('./database'),
Posts.uploadPostImage = function(image, callback) {
if(plugins.hasListeners('filter:uploadImage')) {
plugins.fireHook('filter:uploadImage', image, callback);
plugins.fireHook('filter:uploadImage', {base64: image.data, name: image.name}, callback);
} else {
if (meta.config.allowFileUploads) {
@ -411,7 +411,7 @@ var db = require('./database'),
Posts.uploadPostFile = function(file, callback) {
if(plugins.hasListeners('filter:uploadFile')) {
plugins.fireHook('filter:uploadFile', file, callback);
plugins.fireHook('filter:uploadFile', {base64: file.data, name: file.name}, callback);
} else {
if(!meta.config.allowFileUploads) {

@ -195,13 +195,7 @@ var nconf = require('nconf'),
}
if(plugins.hasListeners('filter:uploadImage')) {
image.convertImageToBase64(req.files.userPhoto.path, function(err, image64) {
if(err) {
return done(err);
}
plugins.fireHook('filter:uploadImage', {data:image64, name:filename}, done);
});
plugins.fireHook('filter:uploadImage', {file: req.files.userPhoto.path, name:filename}, done);
} else {
saveFileToLocal(filename, req, done);
}

@ -172,9 +172,7 @@ var fs = require('fs'),
}
if(plugins.hasListeners('filter:uploadImage')) {
image.convertImageToBase64(req.files.userPhoto.path, function(err, image64) {
plugins.fireHook('filter:uploadImage', {data:image64, name:filename}, done);
});
plugins.fireHook('filter:uploadImage', {file: req.files.userPhoto.path, name: filename}, done);
} else {
user.getUserField(req.user.uid, 'uploadedpicture', function (err, oldpicture) {

Loading…
Cancel
Save