I have this Rails app with Paperclip for image uploads -- but how do I check if the image is an animated GIF with RMagick?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can count the scenes
associated with the image. In Rmagick
that means doing something like this:
image = Magick::ImageList.new(image_file)
if image.scene == 0
#this is not an animated gif
else
#this is an animated gif
end