我正在尝试让Paperclip与Heroku和Amazon S3一起工作。
一切都可以在localhost(mac OS和Amazon)上正常工作,但是当我部署到heroku并尝试该功能时,出现此错误:
2 errors prohibited this area from being saved:
Asset /tmp/paris20121005-2-2cwxgx.jpg is not recognized by the 'identify' command.
Asset /tmp/paris20121005-2-2cwxgx.jpg is not recognized by the 'identify' command.
当我在模型中删除:styles => {}选项时,此方法有效,但未处理文件(我需要不同的图像大小)。
我的gemfile中也有rmagick gem。
这是我的gemfile(仅回形针部分):
gem "paperclip"
gem "rmagick", :require => 'RMagick'
gem 'aws-sdk', '~> 1.3.4'
我在我的environment.rb或production.rb中没有设置Paperclip.options [:command_path],所以在这方面没有问题。
这是我的模特:
class Area < ActiveRecord::Base
require 'RMagick'
has_attached_file :asset, :styles => { :medium => "300x300>", :thumb => "180x190>" },
:storage => :s3,
:s3_credentials => "#{::Rails.root.to_s}/config/s3.yml",
:url => :s3_domain_url.to_s,
:path => "/:style/:id/:filename"
end
有什么线索吗?我已经搜寻了有关它的所有主题,但似乎无济于事...
谢谢
最佳答案
显然,对可卡因gem(0.4.0)的新更新破坏了Paperclip和ImageMagick的文件名。尝试回滚到以前的版本(0.3.2),它对我有用。
看这里:
https://github.com/thoughtbot/paperclip/issues/1038
PS我相信Heroku不再需要RMagick,没有它对我来说效果很好
关于ruby-on-rails - 'identify'命令无法识别图像文件。 (heroku),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12750737/