Forums | Admin

Discussion Forums: open-discussion

Start New Thread Start New Thread

 

By: Martyn Garcia
to_blob [ reply ]  
2006-04-05 16:30
I needed this for work, so I thought I'd share:

module MiniMagick
class Image
def to_blob
output_file = Tempfile.new("minimagic_output")
open(@path) do |image_file|
output_file.write(image_file.read)
end
output_file.close
return IO.read(output_file.path)
end
end
end