gottfrois / link_thumbnailer

Ruby gem that fetches images and metadata from a given URL. Much like popular social website with link preview.
MIT License
512 stars 106 forks source link

Image stats broken for gif images #132

Closed mbajur closed 4 years ago

mbajur commented 6 years ago

I recently noticed that link_thumbnailer is not able to fetch metadata for gif images (when using config.image_stats = true). After doing a tiny research it turned out it's a image_info fault but i doubt we can do much about it as it's not maintained since 2015.

You can test the behavior on these links:

Running LinkThumbnailer on these with image_stats enabled takes a lot of time and results in nils for dimensions and mime type. On the other hand, fast_image deals perfectly fine with these.

mbajur commented 6 years ago

Update: It turned out image_info actually do have a gif support (https://github.com/gottfrois/image_info/search?q=gif&unscoped_q=gif) but it seems it's broken anyway.

Also - it's broken for other kinds of images, scrapping https://umaar.com/dev-tips/151-screenshot-capture/ gives us two images in the results (gif and png) and both of them have dimensions set to nil as well as format.

And oh - i just noticed image_info is yours as well @gottfrois haha, that changes everything, a light in the dark!

gottfrois commented 6 years ago

Hey @mbajur thanks for the notice! Yes I own image_info and it was based on fast_image so it should definitely work the same way 😡 ! I'm quite busy at the moment but I'll gladly accept PRs if you're willing to have a look.

gottfrois commented 4 years ago

@mbajur I've released a new version of ImageInfo which fixes the issues with GIF files. I'm going to make a release of LinkThumnailer as well.