Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paperclip error - NotIdentifiedByImageMagickError

I'm trying to upload images to aws s3 with paperclip but I get this error

Command :: file -b --mime '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-1u773ft.jpg'
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-1rep3kt.jpg[0]' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-1rep3kt.jpg[0]' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
Command :: file -b --mime '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-kfejir.jpg'

In my model, I set up these styles

 has_attached_file :photo, :storage => :s3, :s3_credentials => "#{Rails.root}/config/s3.yml", :path => "/:style/:id/:filename", :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/assets/profile/iama.png"

When I remove these styles, everything works, but I really need them.

I'm using Rails 3.2.16 and

  paperclip (4.1.1)
      activemodel (>= 3.0.0)
      activesupport (>= 3.0.0)
      cocaine (~> 0.5.3)
      mime-types

I already installed ImageMagick and the rmagick gem

Help me please.

like image 752
Minh Tri Pham Avatar asked May 15 '14 22:05

Minh Tri Pham


2 Answers

The problem was that my ImageMagick didn't have JPEG delegates. I found out using convert -list format. So I reinstalled ImageMagick using MacPorts and reinstalled rmagick with the new Paths to ImageMagick.

like image 88
Minh Tri Pham Avatar answered Sep 18 '22 16:09

Minh Tri Pham


I had similar issue and updating imagemagick resolved that. You might want to try that out as well.

like image 44
fruqi Avatar answered Sep 21 '22 16:09

fruqi