Method: Pageflow::ImageFile.scale_down_to_cover

Defined in:
app/models/pageflow/image_file.rb

.scale_down_to_cover(width, height) ⇒ Object

<- UploadableFile-overrides



71
72
73
74
75
76
77
78
79
80
# File 'app/models/pageflow/image_file.rb', line 71

def self.scale_down_to_cover(width, height)
  lambda do |image_file|
    if image_file.width.present? && image_file.height.present? &&
       (image_file.width <= width || image_file.height <= height)
      '100%'
    else
      "#{width}x#{height}^"
    end
  end
end