thoughtbot / paperclip

Easy file attachment management for ActiveRecord
https://thoughtbot.com
Other
9.01k stars 2.43k forks source link

animated gifs with different extensions aren't recognized as animated #715

Closed bzanchet closed 12 years ago

bzanchet commented 12 years ago

On ./lib/paperclip/thumbnail.rb#102 there's an explicit check to confirm that the image extension is "gif". This is preventing perfectly valid animated gif images (see examples) from being recognized as such. Is there a reason for that? Is there a more reliable way of detecting if a given image is animated?

example animated gifs (no extension, and .gifa ):

  1. https://a248.e.akamai.net/assets.github.com/img/3ba24873fade1bf1d82a2265dd1e6073f7a8ec47/687474703a2f2f636c2e6c792f3345324e3345334a3030306b34303051316d31672f6769745f62656172642e676966
  2. http://mm.yimg.com/image/resize/*/550x4500/true/false/http%3A%2F%2Fmeme.zenfs.com%2Fu%2F6727d2a336896d1f08300636ea6c6fcf7d414952.gifa
jyurek commented 12 years ago

The reason this was done originally was because some PDFs were causing big problems when more than one page was processed. We could possibly use identify to detect a file's format and the number of images it contains, but that would require more steps in the process. If you're willing to submit a patch to that end, or to extend the names of the formats that will be treated as animated, we'll consider it.