Reading image file field data directly into RMagick


#1

I’m trying to read image data from an upload file field directly into
an RMagick image object without having to temporally save the image
file first. Assuming my file field param is assigned to @temp_file, i
tried RMagicks from_blob method:

img = Magick::Image::from_blob(@temp_file.read)

But i get an error message saying that the blob is empty. I also
tried feeding it the entire IOString object returned by the file
field, but it can’t deal with it either. Anybody knows how this can
be done? Thanks.

sebastian