3

看起来很多人都有这个相同/相似的问题,并且我在 SO here上找到了一些针对它的报告修复。不幸的是,他们不为我工作。我正在运行 MacOS Lion。这是我到目前为止所做的:

1) 标准 RefineryCMS 安装。运行良好,除了上传图片。2)一旦遇到问题,我就根据 Dragonfly文档添加了一个配置文件:

# configure/initializers/dragonfly.rb
require 'dragonfly/rails/images'

3)那没有用。我重新安装了 ImageMagick。确认 ImageMagick 已安装:

# whereis convert
/usr/bin/convert
# whereis identify
/usr/bin/identify

4) 这并没有解决问题,所以我为 /usr/bin 和 /usr/local/bin 设置了符号链接:

lrwxr-xr-x  1 root  wheel  22 Aug  4 11:00 /usr/bin/convert -> /opt/local/bin/convert
lrwxr-xr-x  1 root  wheel  23 Aug  4 11:01 /usr/bin/identify -> /opt/local/bin/identify
lrwxr-xr-x  1 root  admin  22 Aug  4 11:06 /usr/local/bin/convert -> /opt/local/bin/convert
lrwxr-xr-x  1 root  admin  23 Aug  4 11:07 /usr/local/bin/identify -> /opt/local/bin/identify

5)那没有用,所以我根据 Dragonfly 文档和一些附加说明设置了一个新的配置文件:

# config/initializers/dragonfly.rb
require 'dragonfly'

app = Dragonfly[:images]
app.configure_with(:imagemagick)
app.configure_with(:rails)

app.define_macro(ActiveRecord::Base, :image_accessor)

app.configure do |c|
  c.convert_command = "/opt/local/bin/convert"          # defaults to "convert"
  c.identify_command = "/opt/local/bin/identify"        # defaults to "identify"
  c.log_commands = true                                 # defaults to false
end

6)那并没有解决它。基于一个GitHub 问题,我添加了这个

# config/application.rb
module Refincmstest
  class Application < Rails::Application
    # trying a fix for image magic
    initializer 'override-image-magick-paths', :after => 'attach-refinery-images-with-dragonfly' do
      Dragonfly[:refinery_images].configure do |c|
        c.convert_command = "/opt/local/bin/convert"          # defaults to "convert"
        c.identify_command = "/opt/local/bin/identify"        # defaults to "identify"
      end
    end
  end
end

那没有用。这是控制台输出,如果这有帮助:

Started POST "/refinery/images?dialog=true" for 127.0.0.1 at 2012-08-04 12:23:54 -0700
Processing by Refinery::Admin::ImagesController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"Nddc/uPbbAGevNH15M6nzo/AJmVskIClJYZ5O60KDTU=", "image"=>{"image"=>[#<ActionDispatch::Http::UploadedFile:0x007fe5cd383e10 @original_filename="Photo on 2010-10-27 at 22.46 #2.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"image[image][]\"; filename=\"Photo on 2010-10-27 at 22.46 #2.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/var/folders/rr/1_vvbrvd3ylgpdv8f2z3qqp80000gn/T/RackMultipart20120804-97351-xbv8ew>>]}, "wymeditor"=>"", "modal"=>"true", "dialog"=>"true", "app_dialog"=>"true", "field"=>"", "update_image"=>"", "thumbnail"=>"", "callback"=>"", "conditions"=>"", "locale"=>:en}
  Refinery::Role Load (0.2ms)  SELECT "refinery_roles".* FROM "refinery_roles" WHERE "refinery_roles"."title" = 'Refinery' LIMIT 1
  Refinery::User Load (0.1ms)  SELECT "refinery_users".* FROM "refinery_users" INNER JOIN "refinery_roles_users" ON "refinery_users"."id" = "refinery_roles_users"."user_id" WHERE "refinery_roles_users"."role_id" = 1
  Refinery::User Load (0.1ms)  SELECT "refinery_users".* FROM "refinery_users" WHERE "refinery_users"."id" = 1 LIMIT 1
  Refinery::UserPlugin Load (0.2ms)  SELECT "refinery_user_plugins".* FROM "refinery_user_plugins" WHERE "refinery_user_plugins"."user_id" = 1 ORDER BY position ASC
  Refinery::Role Load (0.1ms)  SELECT "refinery_roles".* FROM "refinery_roles" INNER JOIN "refinery_roles_users" ON "refinery_roles"."id" = "refinery_roles_users"."role_id" WHERE "refinery_roles_users"."user_id" = 1
Completed 500 Internal Server Error in 210ms

Dragonfly::Shell::CommandFailed (Command failed (identify '/var/folders/rr/1_vvbrvd3ylgpdv8f2z3qqp80000gn/T/RackMultipart20120804-97351-xbv8ew') with exit status ):
  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'
  ...

我没主意了。关于下一步去哪里的任何建议?

4

2 回答 2

2

升级到OS X Yosemite后出现此错误。由于我使用 brew 安装了 imagemagick,我运行brew doctor它并报告了各种问题,其中还有一个符号链接问题。我按照说明解决了所有问题,现在它又可以工作了。

于 2014-10-21T09:26:10.943 回答
0

做了更多研究,发现虽然我使用 Mac Ports 来更新 ImageMagick,但我的安装不知何故损坏了。我通过尝试/opt/local/bin/identify手动执行命令发现了这一点。多次尝试使用 Map Ports 重新安装失败(Mac Ports 在 mac book air running lion 上运行时存在一些非常严重的问题。)我安装了 Mac Brew 并通过 brew 安装了 ImageMagick。删除我的符号链接并确保将蜻蜓配置为指向 /usr/local/bin 后,一切正常。

故事的寓意 - 如果您在运行 Lion 的 MacBook Air 上,请不要使用 Mac 端口。即使在使用最新版本重新安装 Mac Ports 后,多个 ImageMagick 先决条件的安装也会失败。几个月前,我安装了另一个 Mac Ports,也发生了类似的事情。不得不暂时退回以前版本的 Mac 开发工具。这样的痛苦。

于 2012-08-05T07:12:06.063 回答