Animated gif and thumbnails

126 views
Skip to first unread message

did

unread,
Jan 26, 2009, 11:40:22 AM1/26/09
to Paperclip Plugin
Hi guys,

I try to upload animated gif and it fails when paperclip tries to crop
the gif image. I've got a NaN error because both width and height are
set to 0. I tested it on Mac os x and Linux (ImageMagick 6.4.0
03/31/08)

I checked the code and found out that the command used to retrieve
dimensions returned, in my case, this:

> identify -format "%wx%h" pdfcreator.gif
468x60466x60468x60468x60468x60468x60468x60435x60442x60450x60456x60465x60468x60468x60...
(I skipped the value but you get the picture)

It does not sound weird since an animated gif is composed of many
images. That's why the identify command returns the dimension of all
the "frames".

Back to paperclip code. The 'parse' method of the Geometry class can
not get the dimension from the previous result. So, I made a tiny
(dirty ?) change in 'from_file' (Geometry class) by modifying the
expected format:
"%wx%h " (I added an empty space) so that identify returns "468x60
466x60 ....". So far it works. I ran the unit and it did not seem to
break any test.

Am I missing something here ? Did somebody meet this problem before ?
Hope it helps.

Did



Lee Hambley

unread,
Jan 26, 2009, 1:14:18 PM1/26/09
to papercli...@googlegroups.com
Did,

 Good call, submit the patch somewhere (with a proper patch file) and see what they say, it's probable that noone has ever run into it.

- Lee

2009/1/26 did <didier.l...@gmail.com>
Reply all
Reply to author
Forward
0 new messages