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 = (’/images/img2.jpg’).first
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


On Oct 17, 2007, at 11:26 AM, Mohamed S. wrote:

def index


Posted via

You probably need to File.expand_path(‘public’ + ‘/images/img2.jpg’,

to get a real file name on your system. I presume that the ‘/images/
img2.jpg’ will be replaced with some variable that is meant to be an
absolute “web” path, but you need a “file system” path.


Rob B.
[email protected]