Rails 4 PaperClip ImageMagick Content Type Error for Images

I’m using ImageMagick and Paperclip for uploading images to my Rails app. It is working on my development machine, a Mac, but not here. When Paperclip tries saving different sizes of the images, ImageMagick give the error


I’m using Paperclip 4.2.1. In my Rails model I have:

has_attached_file :photo_image, :styles => { :medium => "330x250#", :small => "150x120#", :thumb => "120x100#" }, 
                                :url => "/system/dadverts/:attachment/:id/:style/:filename",
                                :path => ":rails_root/public/system/dadverts/:attachment/:id/:style/:filename",
                                :default_url => "300250ad.png"
validates_attachment_content_type :photo_image, :content_type => /\Aimage/

In my production environment settings I have:

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

I’ve run sudo apt-get update a couple of times but this has not resolved the issue.

Any suggestions on what could be wrong would be appreciated.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I’m finally back trying to fix my ImageMagick problem. I ran a search and found I have several references to ImageMagick with different version numbers. I installed version 6.9.0 from source, which only works with GIFs. How do I clean this up to install as suggested by ash?

find / -name ImageMagick /usr/lib/x8664-linux-gnu/ImageMagick-6.7.7 /usr/share/ImageMagick-6.7.7 /usr/share/man/man1/ImageMagick.1.gz /usr/local/lib/pkgconfig/ImageMagick++.pc /usr/local/lib/pkgconfig/ImageMagick-6.Q16.pc /usr/local/lib/pkgconfig/ImageMagick.pc /usr/local/lib/pkgconfig/ImageMagick+±6.Q16.pc /usr/local/lib/ImageMagick-6.9.0 /usr/local/etc/ImageMagick-6 /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick-6/magick/ImageMagick.h /usr/local/share/ImageMagick-6 /usr/local/share/man/man1/ImageMagick.1 /usr/local/share/doc/ImageMagick-6 /usr/local/share/doc/ImageMagick-6/images/ImageMagick.ico /usr/local/share/doc/ImageMagick-6/www/api/MagickCore/ImageMagick8h-source.html /usr/local/share/doc/ImageMagick-6/www/api/MagickCore/ImageMagick_8h.html /usr/local/share/doc/ImageMagick-6/www/ImageMagickObject.html /usr/local/share/doc/ImageMagick-6/www/Magick++/ImageMagick.png /etc/ImageMagick

Can I just delete “/usr/local/lib/ImageMagick-6.9.0”?

This comment has been deleted

asb, I checked the list and found that JPEG and PNG were missing from the list. I’ll try your suggestion and let you know how it goes. Do you think I should delete the current installation and start over? If so, what recommendations would you have for making sure I get it all and not leave anything behind that would cause any conflicts?


The List.