Image file is not recognized by the 'identify' command. (heroku)

依然范特西╮ 提交于 2019-12-09 09:44:54

问题


I'm trying to have Paperclip working with Heroku and Amazon S3.

Everything works fine on localhost (mac OS and Amazon), but when I'm deploying to heroku and trying the feature, I have this error :

2 errors prohibited this area from being saved:
Asset /tmp/paris20121005-2-2cwxgx.jpg is not recognized by the 'identify' command.
Asset /tmp/paris20121005-2-2cwxgx.jpg is not recognized by the 'identify' command.

It works when I remove the :styles => { } option in my model, but the file isn't processed (I need different image sizes).

I also have the rmagick gem in my gemfile.

Here is my gemfile (only the paperclip part) :

gem "paperclip"
gem "rmagick", :require => 'RMagick'
gem 'aws-sdk', '~> 1.3.4'

I don't have Paperclip.options[:command_path] set in my environment.rb or production.rb so no problem on this side.

Here is my model :

class Area < ActiveRecord::Base
  require 'RMagick'
  has_attached_file :asset, :styles => { :medium => "300x300>", :thumb => "180x190>" },
       :storage => :s3,
       :s3_credentials => "#{::Rails.root.to_s}/config/s3.yml",
       :url => :s3_domain_url.to_s,
       :path => "/:style/:id/:filename"
end

Any clue on that ? I've crawled every topics about it and nothing seems to work...

Thanks


回答1:


Apparently the new update to Cocaine gem (0.4.0) breaks the file names for Paperclip and ImageMagick. try rolling back to the previous version (0.3.2), it worked for me.

See here:

https://github.com/thoughtbot/paperclip/issues/1038

PS I believe RMagick is no longer needed on Heroku, works fine for me without it



来源:https://stackoverflow.com/questions/12750737/image-file-is-not-recognized-by-the-identify-command-heroku

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!