Class: Dragonfly::ImageMagick::Analysers::ImageProperties

Inherits:
Object
  • Object
show all
Defined in:
lib/dragonfly/image_magick/analysers/image_properties.rb

Instance Method Summary collapse

Instance Method Details

#call(content) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/dragonfly/image_magick/analysers/image_properties.rb', line 6

def call(content)
  identify_command = content.env[:identify_command] || 'identify'
  details = content.shell_eval do |path|
    "#{identify_command} -ping -format '%m %w %h' #{path}"
  end
  format, width, height = details.split
  {
    'format' => format.downcase,
    'width' => width.to_i,
    'height' => height.to_i
  }
end