mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 16:35:47 +01:00
added filter:image.size
fix uploading of gifs if imagemagick plugin is installed but no image upload plugins are present.
This commit is contained in:
18
src/image.js
18
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) {
|
||||
|
||||
Reference in New Issue
Block a user