Module: Gluttonberg::Library::Config::ImageSizes::ClassMethods

Defined in:
lib/gluttonberg/library/config/image_sizes.rb

Overview

Resize image to have specified area in pixels. Aspect ratio is preserved.

Instance Method Summary collapse

Instance Method Details

#max_image_sizeObject

Returns the max image size as a hash containing :width and :height. May be the default, or the value configured for a particular project.



33
34
35
# File 'lib/gluttonberg/library/config/image_sizes.rb', line 33

def max_image_size
  Rails.configuration.max_image_size || MAX_IMAGE_SIZE
end

#sizesObject

Returns a collection of thumbnail definitions — sizes, filename etc. — which is a merge of defaults and any custom thumbnails defined by the user.



23
24
25
26
27
28
29
# File 'lib/gluttonberg/library/config/image_sizes.rb', line 23

def sizes
  @thumbnail_sizes ||= if Rails.configuration.thumbnails
    Rails.configuration.thumbnails.merge(DEFAULT_THUMBNAILS)
  else
    DEFAULT_THUMBNAILS
  end
end