Module: Url2png::Dimensions

Defined in:
lib/url2png/dimensions.rb

Class Method Summary collapse

Class Method Details

.parse(options) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/url2png/dimensions.rb', line 4

def self.parse options
  # if Url2png.api_version == "v6"
  #   options[:size] ||= "#{options[:thumbnail_max_width]}x#{options[:thumbnail_max_height]}"
  # end
  
  # distill image size
  size   = (options[:size]  || Url2png.default_size).split('x')
  width  = options[:width]  || size[0]
  height = options[:height] || size[1]
  
  # return dimensions hash
  {
    :size   => "#{ width }x#{ height }",
    :width  => width,
    :height => height
  }
end