我想使用带有载波的 rmagick gem 来上传和调整图像大小。
在我的本地 Rails 中.. 效果很好。但是当部署到服务器时..不起作用..
不知道为什么T^T
这里 unicorn_error_log ..
.../shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require': No such file to load -- RMagick (LoadError)
from .../shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
from .../shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from .../shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from .../shared/bundle/ruby/2.0.0/gems/carrierwave-0.9.0/lib/carrierwave/processing/rmagick.rb:67:in `rescue in block in <module:RMagick>'
from ...p/shared/bundle/ruby/2.0.0/gems/carrierwave-0.9.0/lib/carrierwave/processing/rmagick.rb:64:in `block in <module:RMagick>'
from .../shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/concern.rb:114:in `class_eval'
from .../shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/concern.rb:114:in `append_features'
from .../releases/20131018192701/app/uploaders/image_uploader.rb:5:in `include'
from .../releases/20131018192701/app/uploaders/image_uploader.rb:5:in `<class:ImageUploader>'
from .../releases/20131018192701/app/uploaders/image_uploader.rb:3:in `<top (required)>'
但奇怪的是在服务器rails c生产中
a = Word.find(2)
a.image.recreate_versions!(:image, :thumb)
这很好用,没有错误!!!thumb_~~.jpg , 调整大小的图像生成..
并在服务器rails c生产输入
require 'RMagick'
=> false
这意味着 RMagick 已经在加载,对吧?
啊! 这是我的 image_uploader.rb
3: class ImageUploader < CarrierWave::Uploader::Base
5: include CarrierWave::RMagick
52: version :thumb do
53: process :resize_to_limit => [400, 400]
54: end
第 5 行错误!
供参考,我已经在下面完成了..
apt-get install libmagickwand-dev imagemagick
in Gemfile | gem 'rmagick', :require => 'RMagick'
请帮助我..为什么不在服务器上工作?