Project

General

Profile

Feature #32898 » pdf-thumbnail-win-v2.patch

Go MAEDA, 2021-05-16 04:41

View differences:

lib/redmine/platform.rb
(RUBY_PLATFORM == 'java' && /windows/i.match?(ENV['OS'] || ENV['os']))
end
def mswin64?
mswin? && RUBY_PLATFORM.include?('x86_64')
end
def osx?
(/(:?darwin)/.match?(RUBY_PLATFORM))
end
lib/redmine/thumbnail.rb
extend Redmine::Utils::Shell
CONVERT_BIN = (Redmine::Configuration['imagemagick_convert_command'] || 'convert').freeze
GS_BIN = (Redmine::Configuration['gs_command'] || 'gs').freeze
GS_BIN = (
Redmine::Configuration['gs_command'] ||
('gswin64c' if Redmine::Platform.mswin64?) ||
('gwwin32c' if Redmine::Platform.mswin?) ||
'gs'
).freeze
ALLOWED_TYPES = %w(image/bmp image/gif image/jpeg image/png application/pdf)
# Generates a thumbnail for the source image to target
......
def self.gs_available?
return @gs_available if defined?(@gs_available)
if Redmine::Platform.mswin?
begin
`#{shell_quote GS_BIN} -version`
@gs_available = $?.success?
rescue
@gs_available = false
else
begin
`#{shell_quote GS_BIN} -version`
@gs_available = $?.success?
rescue
@gs_available = false
end
end
logger.warn("gs binary (#{GS_BIN}) not available") unless @gs_available
@gs_available
(2-2/3)