FIX: Use ImageMagick to detect animated images (PR #11702)

This is a fallback when FastImage cannot be used (animated WEBP images).

GitHub

animated? is always called with @file as an argument, so the arg should probably be removed. Especially since this method makes an assumption that there’s just one file (by storing frame count in an instance variable)

Maybe instead of memoizing just the frame count we could save the resulting boolean? (in @animated)

I don’t understand this if.

I want to use this method to detect animated webp but it’s running only when type is different from webp ?

Yes, sorry, my mistake. I did not rewrite the condition when I refactored the early return.

Maybe you meant to test only if it’s different from gif? Since that is supported by FastImage anyway.

I added gif just as a failsafe.