Paperclip::Errors::NotIdentifiedByImageMagickError:
Asked Answered
N

2

6

use paperclip upload image error:

Command :: identify -format %wx%h '/tmp/103120121106-20384-i7dnzy.png[0]' [paperclip] An error was received while processing: # < Paperclip::Errors::NotIdentifiedByImageMagickError: /tmp/103120121106-20384-i7dnzy.png is not recognized by the 'identify' command.>

I find identify:

joinall@nxbbs-server:/nxbbs$ type identify  
identify is hashed (/usr/local/bin/identify) 
joinall@nxbbs-server:/nxbbs$ convert logo: 2.jpg 
joinall@nxbbs-server:/nxbbs$ identify  2.jpg
2.jpg GIF 640x480 640x480+0+0 8-bit sRGB 256c 31.7KB 0.000u 0:00.000

In config/environments/development.rb

 Paperclip.options[:command_path] = "/user/local/bin"

In app/models/user.rb

attr_accessible :avatar
has_attached_file :avatar, :styles=> {:s120 => "120x120>",:s48 => "48x48>",:s16 => "16x16>"}

please help me ,I can not find the problem

Negris answered 6/11, 2012 at 11:11 Comment(1)
Your path is wrong in development.rb. Should be /usr/ not /user/.Adila
H
5

I had a similar problem and i figured out that I was using Paperclip 2.5 and paperclip internally uses cocaine gem. Cocaine 0.4.2 is not backward compatible so I downgraded cocaine to 0.3.2 and it all worked magically. In you Gemfile, just write

gem 'cocaine', '0.3.2'

and run

bundle update
Harlow answered 2/12, 2012 at 4:9 Comment(2)
yes, there is an issue with mismatching versions of cocaine and paperclip github.com/thoughtbot/cocaine/issues/28Distinct
As of January 2, 2014, Paperclip 3.5.2 requires cocaine ~> 0.5.3.Mcnully
D
3

A note to myself and any other person who gets here by googling the error type: Imagemagick will throw this error if it doesn't recognize the file type.

I was getting this error when users were trying to upload images. I kept not being able to reproduce the problem, and it was definitely not a question of uninstalled dependencies. Turns out they were trying to upload an unrecognized mime type -- camera raw images.

Danseur answered 7/3, 2014 at 16:30 Comment(1)
Similar - after upgrading through several versions of everything was getting the error on our test suite, related to an old image used in the tests. Swapped for a newer one and all okNolie

© 2022 - 2024 — McMap. All rights reserved.