Ruby on rails 回形针适用于图像,但不适用于PDF文件

Ruby on rails 回形针适用于图像,但不适用于PDF文件,ruby-on-rails,upload,paperclip,Ruby On Rails,Upload,Paperclip,我有一个Rails 3.1应用程序,它使用回形针。它在本地运行得很好,但在服务器上,我似乎无法让PDF上传正常工作。PNG和JPG图像工作完美 尝试使用PDF附件保存记录时,我遇到以下错误: Avatar /tmp/stream20120110-10803-1whykjx-0.pdf is not recognized by the 'identify' command. Avatar /tmp/stream20120110-10803-1whykjx-0.pdf is not recogniz

我有一个Rails 3.1应用程序,它使用回形针。它在本地运行得很好,但在服务器上,我似乎无法让PDF上传正常工作。PNG和JPG图像工作完美

尝试使用PDF附件保存记录时,我遇到以下错误:

Avatar /tmp/stream20120110-10803-1whykjx-0.pdf is not recognized by the 'identify' command.
Avatar /tmp/stream20120110-10803-1whykjx-0.pdf is not recognized by the 'identify' command.
我检查了Apache日志,其中显示以下内容:

sh: gs: not found
identify: Postscript delegate failed `/tmp/stream20120110-5508-or6g2v-0.pdf': No such file or directory @ pdf.c/ReadPDFImage/634.
sh: gs: not found
identify: Postscript delegate failed `/tmp/stream20120110-5508-or6g2v-0.pdf': No such file or directory @ pdf.c/ReadPDFImage/634.
cache: [POST /courses] invalidate, pass
sh: gs: not found
identify: Postscript delegate failed `/tmp/stream20120110-5508-vgyyz8-0.pdf': No such file or directory @ pdf.c/ReadPDFImage/634.
sh: gs: not found
identify: Postscript delegate failed `/tmp/stream20120110-5508-vgyyz8-0.pdf': No such file or directory @ pdf.c/ReadPDFImage/634.
cache: [POST /courses] invalidate, pass
我不知道问题出在哪里,Imagemagick安装在服务器上(运行Ubuntu),图像文件工作正常。我看不到任何文件大小限制的参考,所以我认为不是这样

感谢您的帮助

编辑:

为了确认,我已经查找了“识别”不识别等问题,并尝试将以下内容添加到我的production.rb环境文件中:

Paperclip.options[:command_path] = "/usr/bin/identify"

但是这没有什么区别。

对于任何感兴趣的人,我采取了以下步骤来纠正这个问题。请注意,我不需要调整图像大小、缩略图等

我更改了如下的模型代码:

class User < ActiveRecord::Base
  has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }
end
class用户{:medium=>“300x300>”,:thumb=>“100x100>”}
结束
为此:

class User < ActiveRecord::Base
  has_attached_file :avatar
end
class用户
看起来它正在尝试将ghostscript作为过程的一部分来运行,也许是为了实现缩略图。也许是一个自定义类来跳过这一步?我将从回形针代码开始,看看默认的PDF处理程序做了什么。也可能是一个配置。明白了,我不需要缩略图或类似的东西,所以我从回形针代码中删除了它。谢谢