mirror of
https://github.com/meineerde/redmine.git
synced 2026-04-07 00:11:40 +00:00
PDF thumbnails support on Windows (#32898).
git-svn-id: http://svn.redmine.org/redmine/trunk@21008 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
a8a87ef47e
commit
8b8a1194ff
@ -180,7 +180,7 @@ 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
|
# Absolute path (e.g. /usr/bin/gs, c:/ghostscript/gswin64c.exe) to
|
||||||
# the `gs` binary. Used to generate attachment thumbnails of PDF files.
|
# the `gs` binary. Used to generate attachment thumbnails of PDF files.
|
||||||
#gs_command:
|
#gs_command:
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,11 @@ 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
|
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)
|
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
|
||||||
@ -73,15 +77,11 @@ module Redmine
|
|||||||
def self.gs_available?
|
def self.gs_available?
|
||||||
return @gs_available if defined?(@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
|
@gs_available = false
|
||||||
else
|
|
||||||
begin
|
|
||||||
`#{shell_quote GS_BIN} -version`
|
|
||||||
@gs_available = $?.success?
|
|
||||||
rescue
|
|
||||||
@gs_available = false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
logger.warn("gs binary (#{GS_BIN}) not available") unless @gs_available
|
logger.warn("gs binary (#{GS_BIN}) not available") unless @gs_available
|
||||||
@gs_available
|
@gs_available
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user