Sha256: 52452ab0469a484a49d4a2e1c1f55d28d11ff06d7db8d9b6dd7cfeca4e72dc13

Contents?: true

Size: 997 Bytes

Versions: 6

Compression:

Stored size: 997 Bytes

Contents

module Dragonfly
  module ImageMagick
    module Processors
      class Convert

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

          input_args = opts['input_args'] if opts['input_args']
          delegate_string = "#{opts['delegate']}:" if opts['delegate']
          frame_string = "[#{opts['frame']}]" if opts['frame']

          content.shell_update :ext => format do |old_path, new_path|
            "#{convert_command} #{input_args} #{delegate_string}#{old_path}#{frame_string} #{args} #{new_path}"
          end

          if format
            content.meta['format'] = format.to_s
            content.ext = format
            content.meta['mime_type'] = nil # don't need it as we have ext now
          end
        end

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

      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dragonfly-1.3.0 lib/dragonfly/image_magick/processors/convert.rb
dragonfly-1.2.1 lib/dragonfly/image_magick/processors/convert.rb
dragonfly-1.2.0 lib/dragonfly/image_magick/processors/convert.rb
dragonfly-1.1.5 lib/dragonfly/image_magick/processors/convert.rb
dragonfly-1.1.4 lib/dragonfly/image_magick/processors/convert.rb
dragonfly-1.1.3 lib/dragonfly/image_magick/processors/convert.rb