can't read image

hi all,

i wanna generate thumbnail from image

i found RMagick and found this code but i can’t run it, so please anyone help me in this issue.

my code

def index
img =
width, height = 100, 100
thumb = img.resize(width, height)

but it throws this exception

unable to open image `/images/img2.jpg': No such file or directory

thanks is relative not to your web root, but to your host
operating system's root.

Try something like:

def index
  fname = RAILS_ROOT + '/images/img2.jpg'
  img =
  img = img.first