docbrown/app/uploaders/profile_image_uploader.rb
Ben Halpern c71b2b182f
Change profile image max size to 8 MB (#20183)
* Change profile image max size to 8 MB

* Stub the const for the sake of the test
2023-09-28 17:05:35 -04:00

18 lines
385 B
Ruby

class ProfileImageUploader < BaseUploader
MAX_FILE_SIZE = 8.megabytes
def filename
"#{secure_token}.#{file.extension}" if original_filename.present?
end
def size_range
1..MAX_FILE_SIZE
end
protected
def secure_token
var = :"@#{mounted_as}_secure_token"
model.instance_variable_get(var) || model.instance_variable_set(var, SecureRandom.uuid)
end
end