diff options
-rw-r--r-- | config/configuration.yml.example | 2 | ||||
-rw-r--r-- | lib/redmine/thumbnail.rb | 18 |
2 files changed, 10 insertions, 10 deletions
diff --git a/config/configuration.yml.example b/config/configuration.yml.example index 842f69e6b..8e350228e 100644 --- a/config/configuration.yml.example +++ b/config/configuration.yml.example @@ -180,7 +180,7 @@ default: # the ImageMagick's `convert` binary. Used to generate attachment thumbnails. #imagemagick_convert_command: - # Absolute path (e.g. /usr/bin/gs, c:/ghostscript/gs.exe) to + # Absolute path (e.g. /usr/bin/gs, c:/ghostscript/gswin64c.exe) to # the `gs` binary. Used to generate attachment thumbnails of PDF files. #gs_command: diff --git a/lib/redmine/thumbnail.rb b/lib/redmine/thumbnail.rb index 4bee4085a..bb5c0ac06 100644 --- a/lib/redmine/thumbnail.rb +++ b/lib/redmine/thumbnail.rb @@ -24,7 +24,11 @@ module Redmine 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.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 @@ -73,15 +77,11 @@ module Redmine 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 |