class Base64ImageWrapper < StringIO
def initialize(data, name=nil)
@name = name || 'image'
@blob = Base64.decode64(data)
super @blob
end
def original_filename
"#@name.#{content_type.split('/').last}"
end
def content_type
@content_type ||= Magick::Image.from_blob(@blob)[0].mime_type
end
end