Class: Dragonfly::ImageMagick::Processors::Convert

Inherits:
Object
  • Object
show all
Defined in:
lib/dragonfly/image_magick/processors/convert.rb

Instance Method Summary collapse

Instance Method Details

#call(content, args = '', opts = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/dragonfly/image_magick/processors/convert.rb', line 6

def call(content, args='', opts={})
  convert_command = content.env[:convert_command] || 'convert'
  format = opts['format']

  frame_string = "[#{opts['frame']}]" if opts['frame']
  content.shell_update :ext => format do |old_path, new_path|
    "#{convert_command} #{old_path}#{frame_string} #{args} #{new_path}"
  end

  if format
    content.meta['format'] = format.to_s
    content.ext = format
  end
end

#update_url(attrs, args = '', opts = {}) ⇒ Object



21
22
23
24
# File 'lib/dragonfly/image_magick/processors/convert.rb', line 21

def update_url(attrs, args='', opts={})
  format = opts['format']
  attrs.ext = format if format
end