ImageMagick和Paperclip在S3(Jcrop)上找不到我的文件的位置
|
我正在尝试允许在我的应用程序上裁剪。但是,当我运行此方法时:
def avatar_geometry(style = :original)
@geometry ||= {}
@geometry[style] ||= Paperclip::Geometry.from_file avatar.path(style)
end
identify: unable to open image `/original/4/nutra.jpg\': No such file or directory @ error/blob.c/OpenBlob/2587.
Paperclip::NotIdentifiedByImageMagickError: /original/4/nutra.jpg is not recognized by the \'identify\' command.
from /Users/skline/.rvm/gems/ruby-1.9.2-p180@nutra/gems/paperclip-cloudfiles-2.3.10.1/lib/paperclip/geometry.rb:26:in `from_file\'
from /Users/skline/NutraNation1/app/models/user.rb:111:in `avatar_geometry\'
from (irb):2
from /Users/skline/.rvm/gems/ruby-1.9.2-p180@nutra/gems/railties-3.0.7/lib/rails/commands/console.rb:44:in `start\'
from /Users/skline/.rvm/gems/ruby-1.9.2-p180@nutra/gems/railties-3.0.7/lib/rails/commands/console.rb:8:in `start\'
from /Users/skline/.rvm/gems/ruby-1.9.2-p180@nutra/gems/railties-3.0.7/lib/rails/commands.rb:23:in `<top (required)>\'
from script/rails:6:in `require\'
from script/rails:6:in `<main>\'
Paperclip中令人反感的代码如下:
def self.from_file file
file = file.path if file.respond_to? \"path\"
geometry = begin
Paperclip.run(\"identify\", \"-format %wx%h :file\", :file => \"#{file}[0]\")
rescue Cocaine::ExitStatusError
\"\"
rescue Cocaine::CommandNotFoundError => e
raise Paperclip::CommandNotFoundError.new(\"Could not run the `identify` command. Please install ImageMagick.\")
end
parse(geometry) ||
raise(NotIdentifiedByImageMagickError.new(\"#{file} is not recognized by the \'identify\' command.\"))
end
我的头像模型如下所示:
AVATAR_SW = 55
AVATAR_SH = 55
AVATAR_NW = 240
AVATAR_NH = 240
has_attached_file :avatar,
:styles => { :normal => [\"#{AVATAR_NW}x#{AVATAR_NH}>\", :jpg],
:small => [\"#{AVATAR_SW}x#{AVATAR_SH}#\", :jpg] }, :storage => :s3,
:s3_credentials => \"#{RAILS_ROOT}/config/s3.yml\",
:path => \"/:style/:id/:filename\"
我给Paperclip在我的development.rb中找到ImageMagick的途径是:我已经证实的Paperclip.options[:command_path] = \"/usr/local/bin/\"
确实是ImageMagick的故乡。
有趣的是,我可以毫无问题地上传图像。只是当我尝试运行此方法以裁剪它们时,我才遇到问题。有什么建议么。使用回形针(2.3.11)
没有找到相关结果
已邀请:
1 个回复
殿虫