Method: Imageproxy::Convert#execute

Defined in:
lib/imageproxy/convert.rb

#execute(user_agent = nil, timeout = nil) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/imageproxy/convert.rb', line 15

def execute(user_agent=nil, timeout=nil)
  if options.overlay
    @overlay_file ||= Tempfile.new("imageproxy").tap(&:close)
    execute_command(curl options.overlay, :user_agent => user_agent, :timeout => timeout, :output => @overlay_file.path)
    execute_command curl(options.source, :user_agent => user_agent, :timeout => timeout) +
                      "| composite #{@overlay_file.path} - - | convert - #{convert_options} #{new_format}#{file.path}"
    file
  else
    execute_command %'#{curl options.source, :user_agent => user_agent, :timeout => timeout} | convert - #{convert_options} #{new_format}#{file.path}'
    file
  end
end