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... -- Posted via http://www.ruby-forum.com/.
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. On 4/7/06 11:42 AM, "Trung Tran" <trung_tran@gmx.de> wrote:> 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...
These instructions seem to have fixed the problem: http://www.tonyarnold.com/articles/2005/08/10/rolling-with-ruby-on-rails-on- mac-os-x-tiger-for-beginners On 4/7/06 11:46 AM, "Vince Puzzella" <vpuz@rogers.com> wrote:> 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. > > > On 4/7/06 11:42 AM, "Trung Tran" <trung_tran@gmx.de> wrote: > >> 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... > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
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 On 4/7/06, Trung Tran <trung_tran@gmx.de> wrote:> 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... > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Kyle Maxwell 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. > > -Kylethanks 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 if img_options[:size] size = img_options[:size].split("x") xres = imglist.first.columns yres = imglist.first.rows if xres > size[0].to_i || yres > size[1].to_i imglist.each do |img| img.change_geometry!(img_options[:size]) do |c, r, i| i.resize!(c, r) end end end end ensure imglist.write dest_path File.chmod options[:permissions], dest_path end end end -- Posted via http://www.ruby-forum.com/.