Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with GIFs #37

Open
tortilaman opened this issue May 9, 2018 · 11 comments
Open

Issues with GIFs #37

tortilaman opened this issue May 9, 2018 · 11 comments

Comments

@tortilaman
Copy link

I've run into a very odd issue with gifs. It revolves around JIMP, but I haven't seen it mentioned there, so I'm not 100% sure yet whether the issue is with JIMP, or with this particular implementation of it.

When trying to upload a gif with apostrophe-images, it gives the generic image error in the browser, and on the server, it gives the following error output:

Unsupported MIME type: image/gif
Unsupported MIME type: image/gif
Unsupported MIME type: image/gif
Unsupported MIME type: image/gif
Unsupported MIME type: image/gif
Unsupported MIME type: image/gif
TypeError: Cannot read property 'bitmap' of undefined
    at Jimp.<anonymous> (/Users/nick/Development/annual-report/cms/node_modules/apostrophe/node_modules/uploadfs/lib/image/jimp.js:46:34)
    at Jimp.throwError (/Users/nick/Development/annual-report/cms/node_modules/jimp/index.js:85:44)
    at ReadFileContext.callback (/Users/nick/Development/annual-report/cms/node_modules/jimp/index.js:201:44)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:366:13)

Jimp knows what the MIME type is in previous functions, and has a conditional to handle image/gif specifically, yet when it gets here, the image variable is undefined. Let me know if there's more information I can provide, I'm not the best at debugging, haha.

@boutell
Copy link
Member

boutell commented May 10, 2018 via email

@boutell
Copy link
Member

boutell commented May 10, 2018 via email

@tortilaman
Copy link
Author

I tried it with several different gifs. Different tools were used to export them and I had them exported at different sizes.

I was a bit confused why it was trying to use Jimp and not ImageMagick or something else.

@boutell
Copy link
Member

boutell commented May 10, 2018 via email

@tortilaman
Copy link
Author

tortilaman commented May 10, 2018

Ah, modifying the PATH could be difficult with cloud hosting, I'll look into it. Thanks for the info. Not to say I'll stop looking into the Jimp issue, but it's probably a good fix for now.

@boutell
Copy link
Member

boutell commented May 10, 2018 via email

@boutell
Copy link
Member

boutell commented May 11, 2018

Oof. I could have sworn JIMP supported GIF at some point. But, uh, no, not so far:

jimp-dev/jimp#166

I'd love to help make it happen, but realistically it would make more sense for us to document the limitation and double down on encouraging people to make sure they have the much, much faster imagemagick, which is available in all linux distros and all the cloud hosting solutions for which I've looked into it.

@boutell
Copy link
Member

boutell commented May 11, 2018

I suppose we could do a flag to fake it, by storing the GIF as-is for all of the sizes if GIF support is not available. But then we're not checking that the GIF is valid, which is not great.

@tortilaman
Copy link
Author

I would think adding documentation to make the limitation clear, along with that flag to fake it is probably sufficient for now.

That being said, in the thread you linked this Jimp compatible gif tool was mentioned. From an initial look it doesn't seem mature enough for production code, and I didn't see if it supports resizing.

I think a more important consideration though is that when using GIFs there's always a quality/filesize compromise (or challenge) that has to be overcome before even uploading. Would resizing gifs that a user (may have) spent a lot of time optimizing cause quality/filesize or optimization issues?

@tortilaman
Copy link
Author

tortilaman commented May 15, 2018

I'll work on a PR for faking it when I've got some time.

@boutell
Copy link
Member

boutell commented May 16, 2018

As you pointed out, faking it won't cut it because the cropping feature is required. Your discovery of the gifwrap module looks promising.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants