我在 Rails 应用程序中使用 PaperClip 插件,如下所示:
has_attached_file :photo, :styles => {:small => '64X64>', :medium => '250X250>'},
:url => "/assets/user_photos/:id/:style/:basename.:extension",
:path => ":rails_root/public/assets/user_photos/:id/:style/:basename.:extension"
# validates_attachment_presence :photo
validates_attachment_content_type :photo, :content_type => ['image/jpeg', 'image/png','image/gif']
validates_attachment_size :photo, :less_than => 1.megabytes
它在开发(Mac OSX + Mongrel)上运行良好。但是当我将它投入生产(Linux Debian + Apache/Passenger)时,它只接受 .gif 并且对于 .png 和 .jpg 出现以下错误:
Photo /tmp/stream20091028-20066-1t1a0oz-0 is not recognized by the 'identify' command.
Photo /tmp/stream20091028-20066-1t1a0oz-0 is not recognized by the 'identify' command.
我尝试按照一些教程的建议添加以下行,但没有帮助!
Paperclip.options[:command_path] = "/usr/local/bin"