Hello! Has anyone got a good way of generating and managing thumbnails for graphics uploaded in a Rails app? I found RIT for Ruby at http:// takuo.jp/rit/ and it looks nice (and very thorough) but if anyone might have something more Rails-specific that would be most helpful. I wonder if there''s any plans to add image-specific file handling to future versions of Rails? It seems like an incredibly frequent need (of mine, at least)... Best, Raymond
I use RMagick http://rmagick.rubyforge.org/ On 4/25/05, Raymond Brigleb <ray-THGPwszTed5CpjqP0VxSwUEOCMrvLtNR@public.gmane.org> wrote:> Hello! > > Has anyone got a good way of generating and managing thumbnails for > graphics uploaded in a Rails app? I found RIT for Ruby at http:// > takuo.jp/rit/ and it looks nice (and very thorough) but if anyone > might have something more Rails-specific that would be most helpful. > > I wonder if there''s any plans to add image-specific file handling to > future versions of Rails? It seems like an incredibly frequent need > (of mine, at least)... > > Best, > Raymond > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On 4/25/05, Raymond Brigleb <ray-THGPwszTed5CpjqP0VxSwUEOCMrvLtNR@public.gmane.org> wrote:> Hello! > > Has anyone got a good way of generating and managing thumbnails for > graphics uploaded in a Rails app? I found RIT for Ruby at http:// > takuo.jp/rit/ and it looks nice (and very thorough) but if anyone > might have something more Rails-specific that would be most helpful. > > I wonder if there''s any plans to add image-specific file handling to > future versions of Rails? It seems like an incredibly frequent need > (of mine, at least)... > > Best, > Raymond > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >I use RMagick as well. Just browsing through a ruby snippet library, I found a nice applicable bit of code: http://www.bigbold.com/snippets/posts/show/71 Dave -- Dave Goodlad dgoodlad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org or dave-eHfbeeWWzZOw5LPnMra/2Q@public.gmane.org http://david.goodlad.ca/
> I wonder if there''s any plans to add image-specific file handling to > future versions of Rails? It seems like an incredibly frequent need (of > mine, at least)...I''m working on some code that do this (though not meant for inclusion in rails): class Person < ActiveRecord::Base include FileProperty image_accessor :picture, :variants => { :medium => { :size => [240], :format => ''JPG'' }, :thumb => { :size => [50,50], :format => ''GIF'' }, } end The image is stored as a set of files in a specific dir with a certain name determined from the record id, table, property, and variant names. It uses RMagick for all the image processing stuff. When you submit a form with a file field "person[photo]", and do: a_person.attributes = @params[''person''][''photo''] a_person.save all variants are generated and the files are saved. I started working on this yesterday, so it''s pretty rough now. I''m incredibly busy and behind schedule on everything due to my mac dying and staying dead for at least another week, but I''ll eventually get my act together and prepare some of my rails extras for release. (I know I owe some people the html programatic generation thing :/) So maybe you''ll see this announced here in a month or so.