Image resize

I have uploaded image form a form and save it in public/images
directory and had saved its information in a table. Now i want
whenever i click the image its enlarged view can be seen. What should
i do? Should i create thumbnail? If yes, how?

Checkout the Attachment_fu plugin:

and rmagick

sudo gem install rmagick (or image science) they are the libraries
that do the resizing.

in your model, you want:

has_attachment :content_type => :image,
                 :storage => :file_system,
                 :max_size => 500.megabytes,
                 :path_prefix => File.join('public', 'assets', ''),
                 :resize_to => '440x594',
                 :thumbnails => { :thumb => [150, 203], :small => [65,
88] }


then in your views you can do;


and returns where the image is stored (which by default is not public/
images but public/assets) but it doesnt matter because its all behind
the scenes for you.

hope it helps