Project

General

Profile

Defect #33283 » 33283.patch

Marius BĂLTEANU, 2020-04-19 19:50

View differences:

config/configuration.yml.example
179 179
  # the ImageMagick's `convert` binary. Used to generate attachment thumbnails.
180 180
  #imagemagick_convert_command:
181
  # Absolute path (e.g. /usr/bin/gs, c:/ghostscript/gs.exe) to
182
  # the `gs` binary. Used to generate attachment thumbnails of PDF files.
183
  #gs_command:
184

  
181 185
  # Configuration of MiniMagick font.
182 186
  #
183 187
  # Redmine uses MiniMagick in order to export a gantt chart to a PNG image.
184
-- lib/redmine/thumbnail.rb.orig
188
++ lib/redmine/thumbnail.rb
......
25 25
    extend Redmine::Utils::Shell
26 26
    CONVERT_BIN = (Redmine::Configuration['imagemagick_convert_command'] || 'convert').freeze
27
    GS_BIN = (Redmine::Configuration['gs_command'] || 'gs').freeze
27 28
    ALLOWED_TYPES = %w(image/bmp image/gif image/jpeg image/png application/pdf)
28 29
    # Generates a thumbnail for the source image to target
......
79 80
        @gs_available = false
80 81
      else
81 82
        begin
82
          `gs -version`
83
          `#{shell_quote GS_BIN} -version`
83 84
          @gs_available = $?.success?
84 85
        rescue
85 86
          @gs_available = false
86 87
        end
87 88
      end
89
      logger.warn("gs binary (#{GS_BIN}) not available") unless @gs_available
88 90
      @gs_available
89 91
    end
    (1-1/1)