You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The next code saves the correct versions to user.avatar, but it uploads only jpg's to S3...
class UserAvatarUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
version :large do
process resize_to_fit: [ 600, 600 ], convert: :jpg
def full_filename (for_file = model.avatar.file)
"large_#{secure_token}.jpg"
end
end
version :small do
process resize_to_fill: [ 216, 216 ], convert: :jpg
def full_filename (for_file = model.avatar.file)
"small_#{secure_token}.jpg"
end
end
version :thumb do
process resize_to_fill: [ 80, 80 ], convert: :png
def full_filename (for_file = model.avatar.file)
"thumb_#{secure_token}.png"
end
end
version :tiny do
process resize_to_fill: [ 50, 50 ], convert: :png
def full_filename (for_file = model.avatar.file)
"tiny_#{secure_token}.png"
end
end
def filename
"#{secure_token}.#{file.extension}" if original_filename.present?
end
protected
def secure_token
var = :"@#{mounted_as}_secure_token"
model.instance_variable_get(var) or model.instance_variable_set(var, SecureRandom.uuid)
end
end
The text was updated successfully, but these errors were encountered:
The next code saves the correct versions to user.avatar, but it uploads only jpg's to S3...
The text was updated successfully, but these errors were encountered: