photomix/app/uploaders/userpic_uploader.rb

28 lines
700 B
Ruby
Raw Normal View History

2012-07-24 23:26:16 +02:00
class UserpicUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
def store_dir
"#{ENV['STORAGE_PATH']}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}/original"
end
def filename
"#{::SecureRandom.hex(8)}#{File.extname(original_filename).downcase}" if original_filename
end
2012-07-26 22:26:23 +02:00
version :mini do
process :resize_to_fit => [50, 50]
def store_dir
"#{ENV['STORAGE_PATH']}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}/mini"
end
end
2012-07-24 23:26:16 +02:00
version :small do
process :resize_to_fit => [100, 100]
def store_dir
"#{ENV['STORAGE_PATH']}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}/small"
end
end
end