Class: HeaderImageUploader
- Inherits:
-
CarrierWave::Uploader::Base
- Object
- CarrierWave::Uploader::Base
- HeaderImageUploader
- Includes:
- CarrierWave::BombShelter, CarrierWave::MiniMagick
- Defined in:
- app/uploaders/header_image_uploader.rb
Instance Method Summary collapse
-
#extension_whitelist ⇒ Object
Add a white list of extensions which are allowed to be uploaded.
- #max_pixel_dimensions ⇒ Object
-
#store_dir ⇒ Object
Override the directory where uploaded files will be stored.
Instance Method Details
#extension_whitelist ⇒ Object
Add a white list of extensions which are allowed to be uploaded. For images you might use something like this:
41 42 43 |
# File 'app/uploaders/header_image_uploader.rb', line 41 def extension_whitelist %w(jpg jpeg png) end |
#max_pixel_dimensions ⇒ Object
7 8 9 |
# File 'app/uploaders/header_image_uploader.rb', line 7 def max_pixel_dimensions [4000, 4000] end |
#store_dir ⇒ Object
Override the directory where uploaded files will be stored. This is a sensible default for uploaders that are meant to be mounted:
13 14 15 |
# File 'app/uploaders/header_image_uploader.rb', line 13 def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end |