9

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

Loïc Reperant
  • 105
  • 1
  • 4

1 Answers1

19

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

Itai Leibowitz
  • 241
  • 2
  • 4
  • Thanks a lot ! Changing the Cocain version to 0.3.2 worked great for me ! And yeah I deleted RMagick it wasn't needed. – Loïc Reperant Oct 06 '12 at 15:12
  • HI @Itai Leibowitz, I got the same problem , however, i didnt include the cocaine gem in my application. at least i cant see it in my gemfile. Could you please tell how can i do it on heroku ? thanks a lot for your help! – justicepenny Oct 12 '12 at 07:33
  • 1
    Heroku includes it automatically on their end - you should just add it to your gemfile like the following: gem 'cocaine', '0.3.2' PS check the original link I posted - there seem to have been updates to paperclip/cocaine to solve this already. – Itai Leibowitz Oct 12 '12 at 17:12
  • Thanks. I was pulling my hair out over this. Didn't realize this gem was included in my bundle. I had a much earlier version (0.1.x) in my Gemfile.lock, and didn't realize it. – umezo Oct 15 '12 at 22:19
  • This has been resolved in 2.8.0 and several other of the latest versions of paperclip. – maletor Nov 13 '12 at 00:08