diff --git a/src/controllers/uploads.js b/src/controllers/uploads.js index d096ecf0de..087889d340 100644 --- a/src/controllers/uploads.js +++ b/src/controllers/uploads.js @@ -83,7 +83,7 @@ function resizeImage(fileObj, callback) { function(next) { fullPath = path.join(nconf.get('base_dir'), nconf.get('upload_path'), '..', fileObj.url); - image.load(fullPath, next); + image.size(fullPath, next); }, function (imageData, next) { if (imageData.width < parseInt(meta.config.maximumImageWidth, 10) || 760) { diff --git a/src/image.js b/src/image.js index 7efe86c6ee..fca120d1e5 100644 --- a/src/image.js +++ b/src/image.js @@ -94,11 +94,19 @@ image.normalise = function(path, extension, callback) { } }; -image.load = function(path, callback) { - new Jimp(path, function(err, data) { - callback(err, data ? data.bitmap : null); - }); -}; +image.size = function(path, callback) { + if (plugins.hasListeners('filter:image.size')) { + plugins.fireHook('filter:image.size', { + path: path, + }, function(err, image) { + callback(err, image); + }); + } else { + new Jimp(path, function(err, data) { + callback(err, data ? data.bitmap : null); + }); + } +} image.convertImageToBase64 = function(path, callback) { fs.readFile(path, function(err, data) {