summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/configuration.yml.example4
-rw-r--r--lib/redmine/thumbnail.rb4
2 files changed, 7 insertions, 1 deletions
diff --git a/config/configuration.yml.example b/config/configuration.yml.example
index a8b6be83c..5dbb7170c 100644
--- a/config/configuration.yml.example
+++ b/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.
diff --git a/lib/redmine/thumbnail.rb b/lib/redmine/thumbnail.rb
index 79f784393..cc9656b3e 100644
--- a/lib/redmine/thumbnail.rb
+++ b/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