我正在运行Paperclip 2.3.11和ImageMagick 6.7.1-1。 我正在将图像上传到Amazon S3帐户。
如果我上传了.png
文件,那么它可以正常运行,如果我上传的是.jpg
,则不会。
当我尝试上传jpg时,这是我视图中生成的错误:
3 errors prohibited this post from being saved:
Photo /var/folders/k9/kw7hkdmx741cqrc1h6_qwc580000gp/T/stream20110817-6147-urdz8d-0.jpg is not recognized by the 'identify' command.
Photo /var/folders/k9/kw7hkdmx741cqrc1h6_qwc580000gp/T/stream20110817-6147-urdz8d-0.jpg is not recognized by the 'identify' command.
Photo /var/folders/k9/kw7hkdmx741cqrc1h6_qwc580000gp/T/stream20110817-6147-urdz8d-0.jpg is not recognized by the 'identify' command.
我的日志是:
Started POST "/posts" for 127.0.0.1 at Wed Aug 17 20:35:12 -0400 2011
Processing by PostsController#create as HTML
Parameters: {"commit"=>"Create Post", "post"=>{"photo"=>#<ActionDispatch::Http::UploadedFile:0x10c64d900 @headers="Content-Disposition: form-data; name=\"post[photo]\"; filename=\"Stonehenge.jpg\"\r\nContent-Type: image/jpeg\r\n", @content_type="image/jpeg", @original_filename="Stonehenge.jpg", @tempfile=#<File:/var/folders/k9/kw7hkdmx741cqrc1h6_qwc580000gp/T/RackMultipart20110817-6147-1uad809-0>>, "title"=>"test", "description"=>"test"}, "authenticity_token"=>"V/EinZAi2NNYx7AokikTpQFkNtADNiauW5vcNGdhTug=", "utf8"=>"\342\234\223"}
[paperclip] identify -format %wx%h '/var/folders/k9/kw7hkdmx741cqrc1h6_qwc580000gp/T/stream20110817-6147-urdz8d-0.jpg[0]' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError: /var/folders/k9/kw7hkdmx741cqrc1h6_qwc580000gp/T/stream20110817-6147-urdz8d-0.jpg is not recognized by the 'identify' command.>
之前有没有遇到过这个?如果有任何其他信息有用,请告诉我。
更新: 只是注意到.jpg文件做在另一台计算机上正常上传(两者都是分别运行10.6 / 10.7的Mac)。这让我更加失落。我的另一台机器上可能配置错误了什么?
答案 0 :(得分:1)
您应该为ImageMagick安装JPG支持。
http://www.randycullom.com/chatterbox/archives/2006/12/installing_imag.html
这是jpegsrc和ImageMagick的其他来源:
答案 1 :(得分:0)
终于解决了这个问题。基于@ floor的答案。 ImageMagick在这台机器上没有jpg支持。我不得不卸载并重新安装,然后卸载并重新安装Rmagick。现在一切正常。