Class: ActiveadminBlog::FeaturedImageUploader

Inherits:
CarrierWave::Uploader::Base
  • Object
show all
Includes:
CarrierWave::MiniMagick
Defined in:
app/uploaders/activeadmin_blog/featured_image_uploader.rb

Instance Method Summary collapse

Instance Method Details

#extension_white_listObject

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_dirObject

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

#stripObject

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