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
|