class Adminpanel::SectionUploader

Public Instance Methods

extension_white_list() click to toggle source

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

# File lib/generators/adminpanel/initialize/templates/section_uploader.rb, line 80
def extension_white_list
  %w(jpg jpeg png)
end
root() click to toggle source
# File lib/generators/adminpanel/initialize/templates/section_uploader.rb, line 7
def root
  Rails.root.join 'public/'
end
store_dir() click to toggle source
# File lib/generators/adminpanel/initialize/templates/section_uploader.rb, line 11
def store_dir
  "uploads/image/#{model.class.name.demodulize}/#{model.id}"
end