summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-05-25 02:36:21 +0000
committerGo MAEDA <maeda@farend.jp>2021-05-25 02:36:21 +0000
commit8b8a1194ff84fd2ad01e616a3b296ed158d8d23c (patch)
treeae46f2be65e4c1b981283ae6e95dc7d67e0421a2 /lib
parenta8a87ef47ea71ed47a828ce5c770668d28a3d54e (diff)
downloadredmine-8b8a1194ff84fd2ad01e616a3b296ed158d8d23c.tar.gz
redmine-8b8a1194ff84fd2ad01e616a3b296ed158d8d23c.zip
PDF thumbnails support on Windows (#32898).
git-svn-id: http://svn.redmine.org/redmine/trunk@21008 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/thumbnail.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/redmine/thumbnail.rb b/lib/redmine/thumbnail.rb
index 4bee4085a..bb5c0ac06 100644
--- a/lib/redmine/thumbnail.rb
+++ b/lib/redmine/thumbnail.rb
@@ -24,7 +24,11 @@ module Redmine
extend Redmine::Utils::Shell
CONVERT_BIN = (Redmine::Configuration['imagemagick_convert_command'] || 'convert').freeze
- GS_BIN = (Redmine::Configuration['gs_command'] || 'gs').freeze
+ GS_BIN = (
+ Redmine::Configuration['gs_command'] ||
+ ('gswin64c' if Redmine::Platform.mswin?) ||
+ 'gs'
+ ).freeze
ALLOWED_TYPES = %w(image/bmp image/gif image/jpeg image/png application/pdf)
# Generates a thumbnail for the source image to target
@@ -73,15 +77,11 @@ module Redmine
def self.gs_available?
return @gs_available if defined?(@gs_available)
- if Redmine::Platform.mswin?
+ begin
+ `#{shell_quote GS_BIN} -version`
+ @gs_available = $?.success?
+ rescue
@gs_available = false
- else
- begin
- `#{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