diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js index 017edbbdb9..52a2c363c2 100644 --- a/public/src/modules/composer.js +++ b/public/src/modules/composer.js @@ -603,6 +603,7 @@ define(['taskbar'], function(taskbar) { textarea.val(currentText.replace(imgText, linkStart + '[' + data.name + '](' + data.url + ')')); composer.posts[post_uuid].uploadsInProgress.pop(); + textarea.focus(); }); } diff --git a/src/posts.js b/src/posts.js index 7bd44f72d1..8dcb1d5d1f 100644 --- a/src/posts.js +++ b/src/posts.js @@ -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) { diff --git a/src/routes/admin.js b/src/routes/admin.js index 90d734e5d4..c98ad0a4ac 100644 --- a/src/routes/admin.js +++ b/src/routes/admin.js @@ -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); } diff --git a/src/routes/user.js b/src/routes/user.js index 147fff2ef1..61dc5a26af 100644 --- a/src/routes/user.js +++ b/src/routes/user.js @@ -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) {