Class: Adminpanel::SectionUploader
- Inherits:
-
CarrierWave::Uploader::Base
- Object
- CarrierWave::Uploader::Base
- Adminpanel::SectionUploader
- Includes:
- CarrierWave::MiniMagick
- Defined in:
- lib/generators/adminpanel/initialize/templates/section_uploader.rb
Instance Method Summary collapse
-
#extension_white_list ⇒ Object
resize_to_limit(width, height).
- #root ⇒ Object
- #store_dir ⇒ Object
Instance Method Details
#extension_white_list ⇒ Object
resize_to_limit(width, height)
Resize the image to fit within the specified dimensions while retaining the original aspect ratio. Will only resize the image if it is larger than the specified dimensions. The resulting image may be shorter or narrower than specified in the smaller dimension but will not be larger than the specified values.
width (Integer) the width to scale the image to height (Integer) the height to scale the image to
80 81 82 |
# File 'lib/generators/adminpanel/initialize/templates/section_uploader.rb', line 80 def extension_white_list %w(jpg jpeg png) end |
#root ⇒ Object
7 8 9 |
# File 'lib/generators/adminpanel/initialize/templates/section_uploader.rb', line 7 def root Rails.root.join 'public/' end |
#store_dir ⇒ Object
11 12 13 |
# File 'lib/generators/adminpanel/initialize/templates/section_uploader.rb', line 11 def store_dir "uploads/image/#{model.class.name.demodulize}/#{model.id}" end |