class Dragonfly::ImageMagick::Analysers::ImageProperties

Public Instance Methods

call(content) click to toggle source
# 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