Skip to content

Commit 7d1902b

Browse files
committed
Merge pull request #18 from francesco-magnoni/patch-1
new-features
2 parents 2185ca2 + 8a01c02 commit 7d1902b

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

lib/imageproxy/command.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ def execute_command(command_line)
1616
def curl(url, options={})
1717
user_agent = options[:user_agent] || "imageproxy"
1818
timeout = options[:timeout] ? "-m #{options[:timeout]} " : ""
19+
authInfo = options[:authInfo]
20+
language = options[:language]
1921
output = options[:output]
20-
%|curl #{timeout}-L -f -s -S -A "#{user_agent}" #{output ? "-o #{output} ": ""}"#{url}"|
22+
%|curl #{timeout}-L -f -s -S #{language ? "--header \"accept-language: #{language}\" " : ""} #{authInfo ? "-u #{authInfo} " : ""} -A "#{user_agent}" #{output ? "-o #{output} ": ""}"#{url}"|
2123
end
2224

2325
def to_path(obj)

lib/imageproxy/convert.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ def initialize(options, settings={})
1818
def execute(user_agent=nil, timeout=nil)
1919
if options.overlay
2020
@overlay_file ||= Tempfile.new("imageproxy").tap(&:close)
21-
try_command_with_timeout(curl options.overlay, :user_agent => user_agent, :timeout => timeout, :output => @overlay_file.path)
22-
try_command_with_timeout curl(options.source, :user_agent => user_agent, :timeout => timeout) +
21+
try_command_with_timeout(curl options.overlay, :user_agent => user_agent, :timeout => timeout, :authInfo => options.authInfo, :language => options.language, :output => @overlay_file.path)
22+
try_command_with_timeout curl(options.source, :user_agent => user_agent, :timeout => timeout, :authInfo => options.authInfo, :language => options.language) +
2323
"| composite #{@overlay_file.path} - - | convert - #{convert_options} #{new_format}#{file.path}"
2424
file
2525
else
26-
try_command_with_timeout %'#{curl options.source, :user_agent => user_agent, :timeout => timeout} | convert - #{convert_options} #{new_format}#{file.path}'
26+
try_command_with_timeout %'#{curl options.source, :user_agent => user_agent, :timeout => timeout, :authInfo => options.authInfo, :language => options.language} | convert - #{convert_options} #{new_format}#{file.path}'
2727
file
2828
end
2929
end

0 commit comments

Comments
 (0)