0
votes

I've seen similar post with this error but none of them fixed my problem. I'm using ImageMagick (6.9.0.8)and Paperclip for uploading images to my Rails 4 app. It is working on my development machine, a Mac, but not on my DigitalOcean account (Ubuntu 14.04, Nginx, Unicorn). When Paperclip tries saving different sizes of the images, ImageMagick give the error:

Paperclip::Errors::NotIdentifiedByImageMagickError

I'm using the Paperclip 4.2.1 and Cocaine .0.5.5 gems. 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:

Processing by AdvertisementsController#create as HTML
I, INFO -- :   Parameters: {"utf8"=>"✓", "authenticity_token"=>"8hHWBxpydUyA1MEucXtnSvvRvHc38LcM1hbb8Is/cd4=", "advertisement"=>{"customer_name"=>"Kayak Venice", "ad_network_name"=>"Recon Outpost", "sitead_location_id"=>"1", "publish_date(1i)"=>"2015", "publish_date(2i)"=>"3", "publish_date(3i)"=>"14", "expiration_date(1i)"=>"2020", "expiration_date(2i)"=>"3", "expiration_date(3i)"=>"14", "keywords_alt_text"=>"", "sort_order"=>"1", "local_ad"=>"0", "zipcode"=>"00000", "photo_image"=>#<ActionDispatch::Http::UploadedFile:0x00000005c93038 @tempfile=#<Tempfile:/tmp/RackMultipart20150314-2186-1jc6u31>, @original_filename="KayakLogoConcept3.png", @content_type="image/png", @headers="Content-Disposition: form-data; name=\"advertisement[photo_image]\"; filename=\"KayakLogoConcept3.png\"\r\nContent-Type: image/png\r\n">, "render_options"=>"1", "click_thru_url"=>"", "external_media_embed"=>""}, "advertisment"=>{"publish"=>"0"}, "commit"=>"Create Advertisement"}
I,  INFO -- : Command :: PATH=/usr/local/bin/:$PATH file -b --mime '/tmp/af961aaf697aaa71682a6e9716d6034520150314-2186-pxyhur.png'
I,  INFO -- : Command :: PATH=/usr/local/bin/:$PATH identify -format '%wx%h,%[exif:orientation]' '/tmp/af961aaf697aaa71682a6e9716d6034520150314-2186-o1r33b.png[0]' 2>/dev/null
I,  INFO -- : [paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
I,  INFO -- : Command :: PATH=/usr/local/bin/:$PATH identify -format '%wx%h,%[exif:orientation]' '/tmp/af961aaf697aaa71682a6e9716d6034520150314-2186-o1r33b.png[0]' 2>/dev/null
I,  INFO -- : [paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
I,  INFO -- : Command :: PATH=/usr/local/bin/:$PATH identify -format '%wx%h,%[exif:orientation]' '/tmp/af961aaf697aaa71682a6e9716d6034520150314-2186-o1r33b.png[0]' 2>/dev/null
I,  INFO -- : [paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
I,  INFO -- : Command :: PATH=/usr/local/bin/:$PATH file -b --mime '/tmp/af961aaf697aaa71682a6e9716d6034520150314-2186-91e4eo.png'
I,  INFO -- : Command :: PATH=/usr/local/bin/:$PATH identify -format '%wx%h,%[exif:orientation]' '/tmp/af961aaf697aaa71682a6e9716d6034520150314-2186-fwjtt8.png[0]' 2>/dev/null
I,  INFO -- : [paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
I,  INFO -- : Command :: PATH=/usr/local/bin/:$PATH identify -format '%wx%h,%[exif:orientation]' '/tmp/af961aaf697aaa71682a6e9716d6034520150314-2186-fwjtt8.png[0]' 2>/dev/null
I,  INFO -- : [paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
I,  INFO -- : Command :: PATH=/usr/local/bin/:$PATH identify -format '%wx%h,%[exif:orientation]' '/tmp/af961aaf697aaa71682a6e9716d6034520150314-2186-fwjtt8.png[0]' 2>/dev/null
I,  INFO -- : [paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
I,  INFO -- : Command :: PATH=/usr/local/bin/:$PATH file -b --mime '/tmp/af961aaf697aaa71682a6e9716d6034520150314-2186-k19vf3.png'
I,  INFO -- :   Rendered advertisements/_form.html.erb (65.2ms)
2
Requires full backtrace of error to investigate problem.Maxim
maxd, I've attached a sample from my production log.rustyHack
maxd, it's a plain PNG file, created in Illustrator. I don't remember installing any special processors. I'm thinking I may have to re-install IM but I hoping someone here answers this. Thxs.rustyHack

2 Answers

1
votes

This error class has description:

# Will be thrown when ImageMagic cannot determine the uploaded file's
# metadata, usually this would mean the file is not an image.

This is mean that you are trying to process not image file. Seems like it can be related to incorrect extension of temporary file. Look at this file extension:

af961aaf697aaa71682a6e9716d6034520150314-2186-o1r33b.png[0]

As you can see it has [0] at the end. So, try to investigate why this extension is appear. Seems like you are using custom processor base on Cocaine. I think problem can be related to it.

0
votes

Anything new for this issue? I got the same problem and open a new issue on github:

https://github.com/thoughtbot/cocaine/issues/84