1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-19 15:01:14 +00:00

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
This commit is contained in:
Go MAEDA 2020-04-20 14:15:18 +00:00
parent 0421636cd7
commit 55b9024569
2 changed files with 7 additions and 1 deletions

View File

@ -179,6 +179,10 @@ default:
# the ImageMagick's `convert` binary. Used to generate attachment thumbnails. # the ImageMagick's `convert` binary. Used to generate attachment thumbnails.
#imagemagick_convert_command: #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. # Configuration of MiniMagick font.
# #
# Redmine uses MiniMagick in order to export a gantt chart to a PNG image. # Redmine uses MiniMagick in order to export a gantt chart to a PNG image.

View File

@ -25,6 +25,7 @@ module Redmine
extend Redmine::Utils::Shell extend Redmine::Utils::Shell
CONVERT_BIN = (Redmine::Configuration['imagemagick_convert_command'] || 'convert').freeze 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) ALLOWED_TYPES = %w(image/bmp image/gif image/jpeg image/png application/pdf)
# Generates a thumbnail for the source image to target # Generates a thumbnail for the source image to target
@ -79,12 +80,13 @@ module Redmine
@gs_available = false @gs_available = false
else else
begin begin
`gs -version` `#{shell_quote GS_BIN} -version`
@gs_available = $?.success? @gs_available = $?.success?
rescue rescue
@gs_available = false @gs_available = false
end end
end end
logger.warn("gs binary (#{GS_BIN}) not available") unless @gs_available
@gs_available @gs_available
end end