# File\_column and animated gifs

**URL:** <https://www.ruby-forum.com/t/file-column-and-animated-gifs/57169>\
**Category:** Rails\
**Created:** [April 7, 2006, 5:42pm UTC](https://www.ruby-forum.com/t/file-column-and-animated-gifs/57169 "2006-04-07T17:42:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![trung](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/4bbf92/32.png) [@trung](https://www.ruby-forum.com/u/trung)\
**Post date:** [April 7, 2006, 5:42pm UTC](https://www.ruby-forum.com/t/file-column-and-animated-gifs/57169/1 "2006-04-07T17:42:31Z")

</div>

hi,

is it possible to resize animated gifs with file\_column?  
if i upload an animated gif file with file\_column than the animation no  
longer exists…

---

<div class="post-metadata">

**Author:** ![trung](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/4bbf92/32.png) [@trung](https://www.ruby-forum.com/u/trung)\
**Post date:** [April 7, 2006, 5:47pm UTC](https://www.ruby-forum.com/t/file-column-and-animated-gifs/57169/2 "2006-04-07T17:47:10Z")

</div>

Hi folks,

I just started getting this error all of a sudden (command line  
snippet):

vmac:~/workspace/eir vince$ ruby -v  
ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]  
vmac:~/workspace/eir vince$ rails -v  
Rails 1.0.0  
vmac:~/workspace/eir vince$ gem -v  
0.8.11  
vmac:~/workspace/eir vince$ ./script/server  
/usr/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:21:in  
`require__': No such file to load -- initializer (LoadError) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in`require’  
from ./script/…/config/boot.rb:16  
from ./script/server:2:in `require’  
from ./script/server:2  
vmac:~/workspace/eir vince$

Is anybody else having the same issue? Any clues as to what may be  
wrong?  
I did nothing to my environment, but the problem started after Mac OS X  
notified me that updates were available and I started them in the  
back-ground.

---

<div class="post-metadata">

**Author:** ![trung](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/4bbf92/32.png) [@trung](https://www.ruby-forum.com/u/trung)\
**Post date:** [April 7, 2006, 6:14pm UTC](https://www.ruby-forum.com/t/file-column-and-animated-gifs/57169/3 "2006-04-07T18:14:49Z")

</div>

These instructions seem to have fixed the problem:  
[http://www.tonyarnold.com/articles/2005/08/10/rolling-with-ruby-on-rails-on-](http://www.tonyarnold.com/articles/2005/08/10/rolling-with-ruby-on-rails-on-)  
mac-os-x-tiger-for-beginners

---

<div class="post-metadata">

**Author:** ![trung](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/4bbf92/32.png) [@trung](https://www.ruby-forum.com/u/trung)\
**Post date:** [April 7, 2006, 10:10pm UTC](https://www.ruby-forum.com/t/file-column-and-animated-gifs/57169/4 "2006-04-07T22:10:09Z")

</div>

Yes, but you may have to tinker around with RMagick/imagemagick. I  
would _guess_ that your image is being split into its component frames  
as its being resized, and the command to merge the frames back into an  
animation is not being given. So that’s a bug you’ll have to get  
past, but then it should work.

-Kyle

---

<div class="post-metadata">

**Author:** ![trung](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/4bbf92/32.png) [@trung](https://www.ruby-forum.com/u/trung)\
**Post date:** [April 7, 2006, 10:37pm UTC](https://www.ruby-forum.com/t/file-column-and-animated-gifs/57169/5 "2006-04-07T22:37:47Z")

</div>

Kyle M. wrote:

> Yes, but you may have to tinker around with RMagick/imagemagick. I  
> would _guess_ that your image is being split into its component frames  
> as its being resized, and the command to merge the frames back into an  
> animation is not being given. So that’s a bug you’ll have to get  
> past, but then it should work.
> 
> -Kyle

thanks for reply kyle

now i just use Magick::ImageList instead of Magick::Image and it seems  
to work  
so the class BaseUploadedFile looks something like this:

class BaseUploadedFile # :nodoc:  
def transform\_with\_magick  
if needs\_resize?  
begin  
imglist = ::Magick::ImageList.new(absolute\_path)  
rescue ::Magick::ImageMagickError  
@magick\_errors ||= []  
@magick\_errors \<\< “invalid image”  
return  
end

```
    ...

  end
end

...

def resize_image(imglist, img_options, dest_path)
  begin
    if img_options[:crop]
      dx, dy = img_options[:crop].split(':').map { |x| x.to_f }
      w, h = (imglist.first.rows * dx / dy), (imglist.first.columns 

```

- dy / dx)  
imglist.each do |img|  
img.crop!(::Magick::CenterGravity, [img.columns, w].min,  
[img.rows, h].min)  
end  
end
