2019-08-14 09:48:44 +00:00
|
|
|
class AvatarUploader < CarrierWave::Uploader::Base
|
|
|
|
include CarrierWave::MiniMagick
|
|
|
|
|
|
|
|
def store_dir
|
|
|
|
if Rails.env.test?
|
|
|
|
"#{Rails.root}/spec/support/uploads/avatar/#{model.class.to_s.underscore}/#{model.id}"
|
|
|
|
else
|
|
|
|
"uploads/avatar/#{model.class.to_s.underscore}/#{model.id}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
version :thumb do
|
2019-10-20 08:47:26 +00:00
|
|
|
process resize_to_fill: [64, 64]
|
2019-08-14 09:48:44 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
version :profile_thumb do
|
2019-10-20 08:47:26 +00:00
|
|
|
process resize_to_fill: [128, 128]
|
2019-08-14 09:48:44 +00:00
|
|
|
end
|
|
|
|
end
|