瀏覽代碼

Fix that thumbnail support for PDF attachments may not be detected (#33283).

Patch by VVD VVD.


git-svn-id: http://svn.redmine.org/redmine/trunk@19712 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/4.2.0
Go MAEDA 4 年之前
父節點
當前提交
55b9024569
共有 2 個文件被更改,包括 7 次插入1 次删除
  1. 4
    0
      config/configuration.yml.example
  2. 3
    1
      lib/redmine/thumbnail.rb

+ 4
- 0
config/configuration.yml.example 查看文件

@@ -179,6 +179,10 @@ 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
# the `gs` binary. Used to generate attachment thumbnails of PDF files.
#gs_command:

# Configuration of MiniMagick font.
#
# Redmine uses MiniMagick in order to export a gantt chart to a PNG image.

+ 3
- 1
lib/redmine/thumbnail.rb 查看文件

@@ -25,6 +25,7 @@ module Redmine
extend Redmine::Utils::Shell

CONVERT_BIN = (Redmine::Configuration['imagemagick_convert_command'] || 'convert').freeze
GS_BIN = (Redmine::Configuration['gs_command'] || 'gs').freeze
ALLOWED_TYPES = %w(image/bmp image/gif image/jpeg image/png application/pdf)

# Generates a thumbnail for the source image to target
@@ -79,12 +80,13 @@ module Redmine
@gs_available = false
else
begin
`gs -version`
`#{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
end


Loading…
取消
儲存