Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class CarrierStringIO < StringIO
def original_filename
# the real name does not matter
"photo.jpeg"
end
def content_type
"image/jpeg"
end
end
class Account < ActiveRecord::Base
mount_uploader :logo, LogoUploader
def logo_data=(data)
io = CarrierStringIO.new(Base64.decode64(data))
self.logo = io
end
end
class LogoUploader < CarrierWave::Uploader::Base
include Cloudinary::CarrierWave
process :convert => 'png'
process :tags => ['logo']
version :standard do
cloudinary_transformation :transformation => [{:width => 140 , :height => 140, :crop => :limit}]
end
version :thumbnail do
cloudinary_transformation :transformation => [{:width => 70, :height => 70, :crop => :limit}]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.