Class: ActiveadminBlog::FeaturedImageUploader
- Inherits:
-
CarrierWave::Uploader::Base
- Object
- CarrierWave::Uploader::Base
- ActiveadminBlog::FeaturedImageUploader
- Includes:
- CarrierWave::MiniMagick
- Defined in:
- app/uploaders/activeadmin_blog/featured_image_uploader.rb
Instance Method Summary collapse
-
#extension_white_list ⇒ Object
Add a white list of extensions which are allowed to be uploaded.
-
#quality(percentage) ⇒ Object
process :quality => 85.
-
#store_dir ⇒ Object
Override the directory where uploaded files will be stored.
-
#strip ⇒ Object
Instance.
Instance Method Details
#extension_white_list ⇒ Object
Add a white list of extensions which are allowed to be uploaded. For images you might use something like this:
56 57 58 |
# File 'app/uploaders/activeadmin_blog/featured_image_uploader.rb', line 56 def extension_white_list ActiveadminSettings.image_file_types end |
#quality(percentage) ⇒ Object
process :quality => 85
19 20 21 22 23 24 25 |
# File 'app/uploaders/activeadmin_blog/featured_image_uploader.rb', line 19 def quality(percentage) manipulate! do |img| img.quality(percentage) img = yield(img) if block_given? img end 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:
29 30 31 |
# File 'app/uploaders/activeadmin_blog/featured_image_uploader.rb', line 29 def store_dir "system/blog/featured_images/#{model.id}" end |
#strip ⇒ Object
Instance
10 11 12 13 14 15 16 |
# File 'app/uploaders/activeadmin_blog/featured_image_uploader.rb', line 10 def strip manipulate! do |img| img.strip img = yield(img) if block_given? img end end |