Reading image file field data directly into RMagick

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(

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.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs