Class: HeaderImageUploader

Inherits:
CarrierWave::Uploader::Base
  • Object
show all
Includes:
CarrierWave::BombShelter, CarrierWave::MiniMagick
Defined in:
app/uploaders/header_image_uploader.rb

Instance Method Summary collapse

Instance Method Details

#extension_whitelistObject

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_dimensionsObject



7
8
9
# File 'app/uploaders/header_image_uploader.rb', line 7

def max_pixel_dimensions
  [4000, 4000]
end

#store_dirObject

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