nodebb-plugin-imagemagick installed an enabled, but GIFs still don't work
I'm trying to enable animated GIFs on my NodeBB. I installed and enabled the Image Magick extension: https://github.com/NodeBB/nodebb-plugin-imagemagick
NodeBB uses a js-only alternative, which may be slower, or less featureful. Additionally, animated gifs are supported with ImageMagick, while they are not supported in the bundled version.
NodeBB v1.0.0 or a suitably recent version
None, just install and activate."
But I'm unable to upload GIFs still.
Look at the only open issue: https://github.com/NodeBB/nodebb-plugin-imagemagick/issues/7
It doesn't work anymore and didn't for more than a year
And a little more context than "cropper broke it":
The NodeBB gets image from cropperjs using
cropper.getCroppedCanvas(). This utilizes
CanvasRenderingContext2D.drawImage()- and this doesn't support animated files. Depending on the browser that means the cropper will send only the first or the last frame of the gif.
There is a way to overcome this problem, but it adds complexity and requires additional dependencies. Basically, the cropper has to have a fallback for animated images, where if one is detected instead of
croppper.getData()is used and the data from it along with the original animated image is passed to another (probably back-end) software that works with gifs - for example ImageMagick.
So the problem with this plugin is in the front-end and a fix would require some changes to how cropper works in core NodeBB.
@oplik0 Thanks, good to know it's broken. Kinda sucks this doesn't work, hope someone can bounty a fix or the extension gets repaired soon.
I doubt it, as repairing it would require either:
- disabling the cropper
- modifying core NodeBB
- somehow bypassing the cropper with a client-side script
Option 2 sounds like the best, but it will require some work and take some time probably (not just to add it to NodeBB, but also time waiting for next release). I think the best way to do it would be to add a fallback for gifs (that is - with animated gifs js will send the unmodified image and data from cropper, so backend can work with it) and a filter hook that fires after that fallback.
Then NodeBB wouldn't need another dependency and you could choose what to use for parsing gifs.
But again - that requires some work and time, and I don't think it's really a priority for NodeBB team so someone from the community would have to contribute
@oplik0 You're correct, of course, the image processor we use, jimp, does not support GIFs. Skipping the cropper on a gif would be doable, I think...
baris last edited by
Good news guys, GIFs are back!!! https://github.com/NodeBB/NodeBB/commit/9a7560049a33e7586faa14942c06c0705d06ce6f
Make sure you have nodebb-plugin-imagemagick installed on your NodeBB. Imagemagick also needs to be installed on your server.
Cannot upvote this enough!!