Project

General

Profile

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

Go MAEDA, 2021-05-23 08:40

View differences:

lib/redmine/thumbnail.rb
24 24
    extend Redmine::Utils::Shell
25 25

  
26 26
    CONVERT_BIN = (Redmine::Configuration['imagemagick_convert_command'] || 'convert').freeze
27
    GS_BIN = (Redmine::Configuration['gs_command'] || 'gs').freeze
27
    GS_BIN = (
28
      Redmine::Configuration['gs_command'] ||
29
      ('gswin64c' if Redmine::Platform.mswin?) ||
30
      'gs'
31
    ).freeze
28 32
    ALLOWED_TYPES = %w(image/bmp image/gif image/jpeg image/png application/pdf)
29 33

  
30 34
    # Generates a thumbnail for the source image to target
......
73 77
    def self.gs_available?
74 78
      return @gs_available if defined?(@gs_available)
75 79

  
76
      if Redmine::Platform.mswin?
80
      begin
81
        `#{shell_quote GS_BIN} -version`
82
        @gs_available = $?.success?
83
      rescue
77 84
        @gs_available = false
78
      else
79
        begin
80
          `#{shell_quote GS_BIN} -version`
81
          @gs_available = $?.success?
82
        rescue
83
          @gs_available = false
84
        end
85 85
      end
86 86
      logger.warn("gs binary (#{GS_BIN}) not available") unless @gs_available
87 87
      @gs_available
(3-3/3)