Commit d6bc3060 by jyurek

Made allotment for ImageMagick being not in the PATH

git-svn-id: https://svn.thoughtbot.com/plugins/paperclip/trunk@186 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
parent ed9c6428
...@@ -23,8 +23,9 @@ module Thoughtbot #:nodoc: ...@@ -23,8 +23,9 @@ module Thoughtbot #:nodoc:
module Paperclip module Paperclip
PAPERCLIP_OPTIONS = { PAPERCLIP_OPTIONS = {
:whiny_deletes => false, :whiny_deletes => false,
:whiny_thumbnails => true :whiny_thumbnails => true
:image_magick_path => "/usr/local/bin"
} }
def self.options def self.options
...@@ -315,7 +316,7 @@ module Thoughtbot #:nodoc: ...@@ -315,7 +316,7 @@ module Thoughtbot #:nodoc:
operator = geometry[-1,1] operator = geometry[-1,1]
geometry, crop_geometry = geometry_for_crop(geometry, orig_io) if operator == '#' geometry, crop_geometry = geometry_for_crop(geometry, orig_io) if operator == '#'
begin begin
command = "convert - -scale '#{geometry}' #{operator == '#' ? "-crop '#{crop_geometry}'" : ""} -" command = "#{options[:image_magick_path]}/convert - -scale '#{geometry}' #{operator == '#' ? "-crop '#{crop_geometry}'" : ""} -"
ActiveRecord::Base.logger.info("Thumbnail: '#{command}'") ActiveRecord::Base.logger.info("Thumbnail: '#{command}'")
thumb = IO.popen(command, "w+") do |io| thumb = IO.popen(command, "w+") do |io|
orig_io.rewind orig_io.rewind
...@@ -335,7 +336,7 @@ module Thoughtbot #:nodoc: ...@@ -335,7 +336,7 @@ module Thoughtbot #:nodoc:
end end
def geometry_for_crop geometry, orig_io def geometry_for_crop geometry, orig_io
IO.popen("identify -", "w+") do |io| IO.popen("#{options[:image_magick_path]}/identify -", "w+") do |io|
orig_io.rewind orig_io.rewind
io.write(orig_io.read) io.write(orig_io.read)
io.close_write io.close_write
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment