回形针 PDF 上传失败(在 Rails 3 生产中出现“无法被‘识别’命令识别”?
当我尝试使用回形针将 PDF 上传到生产服务器时,出现错误:
“identify”命令无法识别 pdf
我的模型如下所示:
has_attached_file :document, :styles => { :sm => {:geometry => "160x160>", :format => :png} }
ImageMagick 已安装,并配置了Production.rb 中识别的正确路径。测试时照片上传至同一服务器,处理无误。
我在这里找到了 StackOverflow 上的另一篇文章( 奇怪的回形针错误消息 ),两者基本上说的是相同的thing- 从模型中删除 :styles,因为 imagemagick/identify 无法从 pdf 创建缩略图。
但它可以在我的本地机器上运行。 pdf上传,生成png缩略图,没有错误。我在Mac上运行passenger/apache/mysql(基本上尽可能接近地镜像生产)。
有什么想法为什么我在生产中遇到错误以及如何修复吗?
谢谢! - 标记
I'm getting an error when I try to upload a PDF to production server using paperclip:
pdf is not recognized by the 'identify' command
My model looks like this:
has_attached_file :document, :styles => { :sm => {:geometry => "160x160>", :format => :png} }
ImageMagick is installed, and configured with the proper path to identify in production.rb. Photos are uploaded to the same server during testing, and they are processed without error.
I have found another post on StackOverflow here ( Weird paperclip error message ) which both basically say the same thing- Remove :styles from the model, because imagemagick/identify can't create thumbnails from pdfs.
But it works on my local machine. The pdf is uploaded and the png thumbnail is generated without error. I'm on a mac running passenger/apache/mysql (basically mirroring production as closely as possible).
Any ideas why I'm getting the error on production, and how to fix?
Thanks!
--Mark
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来你还没有安装 Ghostscript。
ImageMagick 依靠 Ghostscript 来处理 PDF。您可以通过在服务器上运行以下命令(给定 example.pdf 文件)来检查问题是否出在 ImageMagick/Ghostscript 上:
如果返回错误,则安装 Ghostscript 并再试一次。
Sounds like you haven't got Ghostscript installed.
ImageMagick relies on Ghostscript to handle PDFs. You can check that the problem is with ImageMagick/Ghostscript by running the following command on the server, given a sample.pdf file:
If this returns an error then install Ghostscript and give it another go.