ImageMagick 不允许我上传 jpg

发布于 2024-11-29 22:11:10 字数 1883 浏览 1 评论 0原文

我正在运行 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)。这让我更加失落。我的另一台机器上可能配置错误?

I am running Paperclip 2.3.11 and ImageMagick 6.7.1-1.
I am uploading images to an Amazon S3 account.

If I upload a .png file it works fine, if I upload a .jpg it does not.

This is the error generated in my view when I try uploading a 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.

And my log reads:

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.>

Has anyone encountered this before? Let me know if any other info would be helpful.

UPDATE:
Just noticed that .jpg files do upload fine on a different computer (both are Macs running 10.6/10.7 respectively). This leaves me even more lost. What could be misconfigured on my other machine?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

归途 2024-12-06 22:11:10

您应该安装 ImageMagick 的 JPG 支持。

http://www.randycullom.com/chatterbox/archives/ 2006/12/installing_imag.html

这里是 jpegsrc 和 ImageMagick 的其他来源:

http://www.imagemagick.org/download/delegates/

You should install JPG support for ImageMagick.

http://www.randycullom.com/chatterbox/archives/2006/12/installing_imag.html

Here is jpegsrc and other sources for ImageMagick:

http://www.imagemagick.org/download/delegates/

渔村楼浪 2024-12-06 22:11:10

终于解决了这个问题。基于@floor的回答。 ImageMagick 在本机上不支持 jpg。我必须卸载并重新安装,然后也卸载并重新安装 Rmagick。现在一切正常。

Finally got this fixed. Based on @floor's answer. ImageMagick did not have jpg support on this machine. I had to uninstall and reinstall, then uninstall and reinstall Rmagick as well. Everything is working now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文