views:

36

answers:

2

Hello! I am looking for a tutorial/how-to for uploading and storing images in rails. I searched google, but all I found was "...use imagemagick" or stuff like that. But I did not find any step by step tutorial (including installing imagemagick or a different image-plugin).

Can you give me a step by step tutorial (including installing the required plugins)? I am using Netbeans.

All I want is uploading images, resize images (save a picture in 3 different sizes), store images and display them.

Please help me! I need a tutorial for dummies :)

+4  A: 

There is a Railscast for using paperclip. Maybe this is for you...?

http://railscasts.com/episodes/134-paperclip

flitzwald
+1 was just writing the same. One alternative, if you prefer reading over watching a video: http://asciicasts.com/episodes/134-paperclip
jigfox
thank you! thats exactly what i am looking for!
Newbie
+1  A: 

You use paperclip plugin. It is one of the most used plugin in rails.

Before that you have to install imageMagick.

Model look like this

class ImageClass < ActiveRecord::Base
# Paperclip
has_attached_file :photo,
  :styles => {
    :thumb=> "100x100#",
    :large =>   "400x400>" }
end

you can set different sizes of images