似乎有多个人有相同/相似的问题,我在here上找到了一些已报告的修复程序。不幸的是,他们没有为我工作。我正在运行MacOS Lion。到目前为止,这是我所做的:

1)标准RefineryCMS安装。运行良好,除了上传图像。
2)遇到问题后,我为Dragonfly docs添加了一个配置文件:

# 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设置了符号链接(symbolic link):
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文档和其他一些instructions设置了一个新的配置文件:
# 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 issue我添加了这个
# 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'
  ...

我没主意了。关于下一步的建议?

最佳答案

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

关于ruby-on-rails-3 - Rails 3和RefineryCMS-Dragonfly::Shell::Command在Refinery::Admin::ImagesController#create中失败,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11812011/

10-09 15:08