wyc
wyc

Reputation: 55303

Getting Image Paperclip::Errors::NotIdentifiedByImageMagickError after updating to Paperclip 3.4.0

I got the following message after upgrading:

Paperclip 3.0 introduces a non-backward compatible change in your attachment path. This will help to prevent attachment name clashes when you have multiple attachments with the same name. If you didn't alter your attachment's path and are using Paperclip's default, you'll have to add :path and :url to your has_attached_file definition. For example:

has_attached_file :avatar,
  :path => ":rails_root/public/system/:attachment/:id/:style/:filename",
  :url => "/system/:attachment/:id/:style/:filename"

So I did so:

post.rb:

 has_attached_file :image, :styles => { :medium => "170x300>",
                                         :thumb => "142x185>" },
                    :path => ":rails_root/public/system/:attachment/:id/:style/:filename",
                    :url => "/system/:attachment/:id/:style/:filename"

But then I saw this error message:

  • Image Paperclip::Errors::NotIdentifiedByImageMagickError

I even added this to environments/development.rb:

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

(which identify outputs /usr/bin/identify)

But still no luck.

What could be the problem?

Upvotes: 0

Views: 1899

Answers (2)

Nishutosh Sharma
Nishutosh Sharma

Reputation: 1936

The issue is in the filename. colons are not accepted, if you remove the colon from the attachment name using gsub it'll be accepted always.

Upvotes: 1

wyc
wyc

Reputation: 55303

Wow, I didn't expect this. The problem wasn't due to upgrading. It was because the file I was uploading was named like this:

Screenshot at 2012-11-26 16:22:44.png

Weird.

Upvotes: 2

Related Questions