8

我正在开发一个在本地运行良好的refinerycms rails 应用程序,现在我已将其移至我的VPS,我遇到了我通过refinerycms 上传的图像未加载的问题,我一直在阅读我需要升级我的 imagemagick 版本。我从 6.2.8 升级到 6.7.8。现在图像都加载到某些页面上,但不是在管理端。

是什么导致了这个问题?这是错误的堆栈跟踪。

Dragonfly::Shell::CommandFailed (Command failed (convert '/var/www/vhosts/tomstestsite.us/PersonalTrainingKT/public/system/refinery/images/2012/06/03/16_36_48_339_pamLemke_after.jpg' '-resize' '225x255>' '/tmp/dragonfly20120705-7812-1xb3pce') with exit status 127):
  dragonfly (0.9.12) lib/dragonfly/shell.rb:29:in `raise_shell_command_failed'
  dragonfly (0.9.12) lib/dragonfly/shell.rb:23:in `run'
  dragonfly (0.9.12) lib/dragonfly/image_magick/utils.rb:17:in `convert'
  dragonfly (0.9.12) lib/dragonfly/image_magick/processor.rb:103:in `convert'
  dragonfly (0.9.12) lib/dragonfly/image_magick/processor.rb:27:in `resize'
  dragonfly (0.9.12) lib/dragonfly/image_magick/processor.rb:87:in `thumb'
  dragonfly (0.9.12) lib/dragonfly/function_manager.rb:39:in `call'
  dragonfly (0.9.12) lib/dragonfly/function_manager.rb:39:in `block (2 levels) in call_last'
  dragonfly (0.9.12) lib/dragonfly/function_manager.rb:38:in `catch'
  dragonfly (0.9.12) lib/dragonfly/function_manager.rb:38:in `block in call_last'
  dragonfly (0.9.12) lib/dragonfly/function_manager.rb:37:in `each'
  dragonfly (0.9.12) lib/dragonfly/function_manager.rb:37:in `call_last'
  dragonfly (0.9.12) lib/dragonfly/processor.rb:5:in `process'
  dragonfly (0.9.12) lib/dragonfly/job.rb:79:in `apply'
  dragonfly (0.9.12) lib/dragonfly/job.rb:253:in `block in apply'
  dragonfly (0.9.12) lib/dragonfly/job.rb:253:in `each'
  dragonfly (0.9.12) lib/dragonfly/job.rb:253:in `apply'
  dragonfly (0.9.12) lib/dragonfly/response.rb:25:in `to_response'
  dragonfly (0.9.12) lib/dragonfly/server.rb:43:in `block in call'
  dragonfly (0.9.12) lib/dragonfly/server.rb:39:in `catch'
  dragonfly (0.9.12) lib/dragonfly/server.rb:39:in `call'
  dragonfly (0.9.12) lib/dragonfly/middleware.rb:11:in `call'
  rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
  rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
  rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
  rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
  rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
  rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
  rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
  rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
  rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
  rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/reloader.rb:65:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.3) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.3) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/static.rb:62:in `call'
  railties (3.2.3) lib/rails/engine.rb:479:in `call'
  railties (3.2.3) lib/rails/application.rb:220:in `call'
  railties (3.2.3) lib/rails/railtie/configurable.rb:30:in `method_missing'
  passenger (3.0.11) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
  passenger (3.0.11) lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
  passenger (3.0.11) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
  passenger (3.0.11) lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
  passenger (3.0.11) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `block in handle_spawn_application'
  passenger (3.0.11) lib/phusion_passenger/utils.rb:479:in `safe_fork'
  passenger (3.0.11) lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
  passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
  passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
  passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:180:in `start'
  passenger (3.0.11) lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
  passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:219:in `block (2 levels) in spawn_rails_application'
  passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
  passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:214:in `block in spawn_rails_application'
  passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
  <internal:prelude>:10:in `synchronize'
  passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
  passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
  passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
  passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
  passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
  passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
  passenger (3.0.11) helper-scripts/passenger-spawn-server:99:in `<main>'

更新

我已按照此处的建议将以下代码添加到我的 config/application.rb 文件中,它帮助显示了一些文件,但我仍然无法通过应用程序上传文件,此堆栈跟踪的一部分如下所示.

config/application.rb 包含这个

initializer 'override-image-magick-paths', :after => 'attach-refinery-images-with-
    dragonfly' do
      app=Dragonfly[:refinery_images]
      app.configure_with(:imagemagick)
      app.configure do |c|
        c.convert_command = "/usr/local/bin/convert"          # defaults to "convert"
        c.identify_command = "/usr/local/bin/identify"        # defaults to "identify"
      end
    end

堆栈跟踪

 Dragonfly::Shell::CommandFailed (Command failed (identify '/tmp/RackMultipart20120708-20096-4m1k9j') with exit status 127):
      dragonfly (0.9.12) lib/dragonfly/shell.rb:29:in `raise_shell_command_failed'
      dragonfly (0.9.12) lib/dragonfly/shell.rb:23:in `run'
      dragonfly (0.9.12) lib/dragonfly/image_magick/utils.rb:34:in `raw_identify'
      dragonfly (0.9.12) lib/dragonfly/image_magick/utils.rb:24:in `identify'
      dragonfly (0.9.12) lib/dragonfly/image_magick/analyser.rb:44:in `format'
      dragonfly (0.9.12) lib/dragonfly/function_manager.rb:39:in `call'
      dragonfly (0.9.12) lib/dragonfly/function_manager.rb:39:in `block (2 levels) in call_last'
      dragonfly (0.9.12) lib/dragonfly/function_manager.rb:38:in `catch'
      dragonfly (0.9.12) lib/dragonfly/function_manager.rb:38:in `block in call_last'
      dragonfly (0.9.12) lib/dragonfly/function_manager.rb:37:in `each'
      dragonfly (0.9.12) lib/dragonfly/function_manager.rb:37:in `call_last'
      dragonfly (0.9.12) lib/dragonfly/analyser.rb:25:in `analyse'
      dragonfly (0.9.12) lib/dragonfly/job.rb:247:in `analyse'
4

4 回答 4

6

我只是重新安装了 imagemagick 并且它起作用了。

于 2013-05-05T04:30:41.467 回答
5

我从 /usr/bin/convert -> /usr/local/bin/convert 和 /usr/bin/identify -> /usr/local/bin/identify 创建了一个符号链接,这似乎解决了我的问题。

$ cd /usr/bin
$ ln -s /usr/local/bin/convert convert
$ ln -s /usr/local/bin/identify identify 

我假设即使我在我的 config/application.rb 文件中指定了它,蜻蜓仍然没有获取我的转换和识别位置。

于 2012-07-09T17:29:06.787 回答
1

您可能必须提供完整路径convert

config/initializers/dragonfly.rb:

app.configure do |c|
  c.convert_command = "/usr/bin/convert"
end

更改/usr/bin/convert为 的正确路径convert,您可以通过whereis convert在 VPS shell 上运行来找到该路径。

文档中的更多详细信息。

于 2012-07-06T04:50:50.853 回答
1

尝试安装炼油厂图像 gem:

Gemfile:
   gem 'refinerycms-page-images', '~>1.0.3' //refinery v1 compatible (v2 available also)

然后在你的模型中:

belongs_to :imagesizeyouwant, :class_name => 'Image'

如果您查看 Image 类,您会发现处理图像的设置非常好。您可以在管理工具的 Refinery 设置页面中添加图像尺寸。如果您有自定义引擎,只需将 :imagesizeyouwant 更改为该大小(我的是 :thumbnail)。

当您发布图像时,请查看 identify 命令的输出并尝试自行运行它。您的系统可能有不同的参数用于 ImageMagick 二进制文件,或者发送给它的尺寸不被理解。尝试发布 Dragonfly 在 shell 中调用的实际命令的输出,以便我们更好地查看。

于 2012-07-11T19:36:36.123 回答