Feature #37530 » convert-timeout.patch
| lib/redmine/thumbnail.rb | ||
|---|---|---|
|
extend Redmine::Utils::Shell
|
||
|
CONVERT_BIN = (Redmine::Configuration['imagemagick_convert_command'] || 'convert').freeze
|
||
|
CONVERT_TIMEOUT = 10
|
||
|
GS_BIN = (
|
||
|
Redmine::Configuration['gs_command'] ||
|
||
|
('gswin64c' if Redmine::Platform.mswin?) ||
|
||
| ... | ... | |
|
size_option = "#{size}x#{size}>"
|
||
|
if is_pdf
|
||
|
cmd = "#{shell_quote CONVERT_BIN} #{shell_quote "#{source}[0]"} -thumbnail #{shell_quote size_option} #{shell_quote "png:#{target}"}"
|
||
|
cmd = "#{shell_quote CONVERT_BIN} -limit time #{shell_quote CONVERT_TIMEOUT.to_s} #{shell_quote "#{source}[0]"} -thumbnail #{shell_quote size_option} #{shell_quote "png:#{target}"}"
|
||
|
else
|
||
|
cmd = "#{shell_quote CONVERT_BIN} #{shell_quote source} -auto-orient -thumbnail #{shell_quote size_option} #{shell_quote target}"
|
||
|
cmd = "#{shell_quote CONVERT_BIN} -limit time #{shell_quote CONVERT_TIMEOUT.to_s} #{shell_quote source} -auto-orient -thumbnail #{shell_quote size_option} #{shell_quote target}"
|
||
|
end
|
||
|
unless system(cmd)
|
||
|
logger.error("Creating thumbnail failed (#{$?}):\nCommand: #{cmd}")
|
||