thoughtbot / cocaine

A small library for doing (command) lines.
https://robots.thoughtbot.com
Other
785 stars 55 forks source link

0.4.0 breaks paperclip and imagemagick #28

Closed sbounmy closed 12 years ago

sbounmy commented 12 years ago

Hi guys,

I did an bundle update today and seems like Cocaine 0.4.0 breaks paperclip & imagemagick on my rails app :

/tmp/xxxxxxx is not recognized by the 'identify' command.

identify: no decode delegate for this image format `' @ error/constitute.c/ReadImage/544.

paperclip 2.7.1 rails 3.2.3 ImageMagick 6.7.7-6 on Mountain Lion

farnoy commented 12 years ago

I can confirm this on linux also: paperclip (3.2.0) cocaine (0.4.0) ImageMagick 6.7.9-8

Line from development.log in Rails

[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: /tmp/DSC_037820121006-11235-1st1ve7.JPG is not recognized by the 'identify' command.>

Paperclip.options[:command_path] is set correctly, this happened after cocaine update (0.3.2 -> 0.4.0)

acanby commented 12 years ago

Confirmed also on OS X Lion: paperclip (3.2.0) cocaine (0.4.0) ImageMagick 6.7.7-6

Rolling back cocaine to 0.3.2 stops the errors occuring.

ItaiLeibowitz commented 12 years ago

+1

gdeest commented 12 years ago

Confirmed on OS X Lion and Ubuntu Oneiric, with paperclip 2 and 3, cocaine 0.4.0 and ImageMagick 6.7.

Looks like Cocaine does not interpolate the ":file" parameter in the identify command line. This is what I get when I print the command output:

identify: unable to open image `:file':  @ error/blob.c/OpenBlob/2489.
mvilrokx commented 12 years ago

omg, I tried to fix this issue for the last 2 days and rolling back cocaine fixed the issue (OSX 10.8.2, Rails 3.2.8). Thank you so much.

radar commented 12 years ago

Confirmed on Travis as well. Heard several reports about this over on spree/spree too. Going to force 0.3.2 until 0.4.x branch is fixed.

radar commented 12 years ago

And I'm still attempting to get to the bottom of this issue. This is greatly annoying.

acanby commented 12 years ago

I had a quick look at this yesterday, but couldn't solve it either.

I wrote a test to pass in the values specified in Paperclip lib/paperclip/geometry.rb:

Paperclip.run("identify", "-format %wx%h :file", :file => "#{file_path}[0]")

and the test passes. I also stepped through the code and :file is interpolated fine.

Will try and get some more time on it tonight. I suspect it could be related to ec9efa2, as this is not in the 3.2 branch.

radar commented 12 years ago

Seems like the latest Paperclip now fixes this problem.

On 08/10/2012, at 15:12, Andrew Canby notifications@github.com wrote:

I had a quick look at this yesterday, but couldn't solve it either.

I wrote a test to pass in the values specified in Paperclip lib/paperclip/geometry.rb:

Paperclip.run("identify", "-format %wx%h :file", :file => "#{file_path}[0]") and the test passes. I also stepped through the code and :file is interpolated fine. Will try and get some more time on it tonight.

— Reply to this email directly or view it on GitHub.

jyurek commented 12 years ago

Sorry about the trouble, everyone. I pushed out Paperclip 3.3.0 and 2.8.0 yesterday to address this. Totally my fault for not getting to it sooner.

rubenrails commented 11 years ago

Still getting the error after upgrading to 3.3.0 (on heroku)

[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: /tmp/il_170x135.29785916120121105-2-x66xed.jpg is not recognized by the 'identify' command.>

heroku run bundle show paperclip
=> /app/vendor/bundle/ruby/1.9.1/gems/paperclip-3.3.0

heroku run bundle show cocaine
=> /app/vendor/bundle/ruby/1.9.1/gems/cocaine-0.4.2

Any ideas?

jyurek commented 11 years ago

@rubenrails That's a different error than the one this issue is about. Please create a new issue so we can track your issue separately. Thanks.

DenizOkcu commented 11 years ago

cocaine 0.5.1 breaks it for me again and going back to 0.3.2 fixes it.

i run imagemagick 6.8.2, rails 3.2.11 and paperclip 3.2.1 on a ubuntu 10.04 setup (nginx with unicorn).

radar commented 11 years ago

Breaks it for you in what particular way? Please show errors and other useful information to leap the people who would debug your problem

On Tuesday, January 29, 2013, DenizOkcu wrote:

cocain 0.5.1 breaks it for me again and going back to 0.3.2 fixes it.

i run imagemagick 6.8.2, rails 3.2.11 and paperclip 3.2.1 on a ubuntu 10.04 setup (nginx with unicorn).

— Reply to this email directly or view it on GitHubhttps://github.com/thoughtbot/cocaine/issues/28#issuecomment-12826938.

DenizOkcu commented 11 years ago

sorry for the incomplete post. this is my error from production.log with version 0.5.1, 0.5.0, 0.4.2, 0.4.1 and 0.4.0:

[paperclip] An error was received while processing:#<Paperclip::Errors::NotIdentifiedByImageMagickError: /tmp/xxxx.png is not recognized by the 'identify' command.>

i have something like this in my model:

has_attached_file :img, :url => "/xxx/:basename.:extension", :styles => { :medium => ["1700x900>", :jpg] }, :convert_options => { :all => "-quality 85" }

identifying images from the commandline is working and i have imagemagick in the command_path. with cocaine 0.3.2 it works again in my rails app. i run imagemagick 6.8.2, rails 3.2.11 and paperclip 3.2.1 on a ubuntu 10.04 setup (nginx with unicorn and ruby 1.9.3p374).

jyurek commented 11 years ago

Paperclip 3.2.1 breaks with cocaine 0.5.1 because the api of cocaine changed. You should use version 3.3.0 of paperclip, at least, if you want the latest cocaine.

DenizOkcu commented 11 years ago

thank you Jon! Paperclip 3.4.0 is now working as expected.

edwardsharp commented 11 years ago

Hello, I'm going to +1 this issue-- was running into the very same errors with 3.1.4 and 3.4.0. However the error does not happen when I switch to the 2.7.5 version of paperclip... I'm guessing this has to do with the cocaine gem. The paperclip 3.x version have a min dependency of cocaine 0.5 so I could not try out using the 0.3.2 version of the cocaine gem with the newer versions of the paperclip gem...

DenizOkcu commented 11 years ago

For me it's fine now. the only issue i ran into was that bundler didn't update to the new versions of paperclip even if i told it so. i had to set the version of paperclip to 3.4.0 in my gemfile (additionally remove cocaine from your gemfile - paperclip will pull the best version by itself. try that).

mattherick commented 11 years ago

I just get this error, when I generate a paperclip upload out from an tempfile. Anybody an idea how I could fix that?

My Code:

def self.create_file(table)
   table_html = render_table_for_xls(table)
   file = Tempfile.new(["#{table.xls_name}", ".xls"], "#{Rails.root.to_s}/tmp/")
   file.write(table_html.force_encoding('utf-8'))
  File.open(file)
end

Asset.create!(:data => MyModel.create_file(self))

Data Paperclip::Errors::NotIdentifiedByImageMagickError

My Gem Versions: rails 3.2.12 paperclip 3.4.2 cocaine 0.5.1

noctivityinc commented 11 years ago

+1 here as well. When trying to save to S3 I get the NotIdentified error but if I save locally it works fine:

Command :: convert '/var/folders/g_/5sbwr8d50vvc7z9k57mrnw2m0000gn/T/dabbleco_3-profile_pic20131007-3752-fpow2x.jpeg[0]' -auto-orient -resize "24x24>" '/var/folders/g_/5sbwr8d50vvc7z9k57mrnw2m0000gn/T/dabbleco_3-profile_pic20131007-3752-fpow2x20131007-3752-1l30ne6'
Command :: file -b --mime '/var/folders/g_/5sbwr8d50vvc7z9k57mrnw2m0000gn/T/dabbleco_3-profile_pic20131007-3752-fpow2x20131007-3752-1l30ne6'
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/g_/5sbwr8d50vvc7z9k57mrnw2m0000gn/T/dabbleco_3-profile_pic20131007-3752-fpow2x.jpeg[0]'
Command :: identify -format '%wx%h,%[exif:orientation]' '/professionals/pics/000/000/017/original/dabbleco_3-profile_pic.jpeg[0]'
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>

I'm running:

paperclip (3.4.2) paperclip-aws (1.6.7) cocaine 0.5.1

and can't downgrade to cocaine 0.3.2 because paperclip 3.4.2 requires 0.5.1

noctivityinc commented 11 years ago

Update - I was able to get this to work by changing the avatar_geometry routine from this gist https://github.com/thoughtbot/paperclip/issues/1289

asecondwill commented 10 years ago

I get this error too. I'm using paperclip 4.1 and rails 4.0.2 & ruby 2.1.1 - i get the error

Cover Paperclip::Errors::NotIdentifiedByImageMagickError

I am running on osx 10.9, and i've checked my imagemagick by doing:

➜  rails git:(aa) ✗ which identify                          
/usr/local/bin/identify

I've got

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

set right at the top of my development.rb environment

Somebody saved themselves with this in the application.rb:

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

but that didn't work for me.

I saw that somebody found running:

brew install libtool --universal
brew link libtool
or 
brew unlink libtool && brew link libtool
Unlinking /usr/local/Cellar/libtool/2.4.2... 0 symlinks removed
Linking /usr/local/Cellar/libtool/2.4.2... 17 symlinks created

helped them out, but it didn't make any difference for me.

I tried

brew install --force jpeg
brew update && brew upgrade `brew outdated`

from https://github.com/thoughtbot/paperclip/issues/1205

which all happened 1st time except: Error: Permission denied - /usr/local/Cellar/libiconv/1.14

Ill check that out and report back.

asecondwill commented 10 years ago

So i got past that with sudo chown -Rwhoami/usr/local but the error persist.

Just found https://github.com/thoughtbot/paperclip/issues/1289 ticket, where some people had issues with a custom geometry method. I don't have one of those, so not that.

I turned on the logs

Paperclip.options[:log] = true 
Paperclip.options[:log_command] = true 

and here is the output:

Started PATCH "/helm/providers/10-test-87" for 127.0.0.1 at 2014-05-15 15:57:29 +1000
Processing by Helm::ProvidersController#update as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"NsoEuLpef3Lst9T6QRSRO4N61Haixt3HwIPO9vql36s=", "provider"=>{"name"=>"test 87", "description"=>"", "address"=>"Level 1, 27 Belgrave Street", "suburb"=>"Manly", "state"=>"New South Wales", "postcode"=>"2095", "phone"=>"61424366468", "website"=>"http://www.theraceguide.com.au", "cover"=>#<ActionDispatch::Http::UploadedFile:0x00000108491c78 @tempfile=#<Tempfile:/var/folders/qt/cvfl_0892yb625qkq7ppt14h0000gq/T/RackMultipart20140515-32533-1pm40me>, @original_filename="happydog.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"provider[cover]\"; filename=\"happydog.jpg\"\r\nContent-Type: image/jpeg\r\n">, "delete_cover"=>"0"}, "commit"=>"Save Settings", "id"=>"10-test-87"}
  AdminUser Load (0.8ms)  SELECT "admin_users".* FROM "admin_users" WHERE "admin_users"."id" = 2 ORDER BY "admin_users"."id" ASC LIMIT 1
  User Load (0.7ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 18 ORDER BY "users"."id" ASC LIMIT 1
  Provider Load (4.1ms)  SELECT "providers".* FROM "providers" WHERE "providers"."id" = $1 ORDER BY "providers"."id" ASC LIMIT 1  [["id", 10]]
   (0.2ms)  BEGIN
Command :: file -b --mime-type '/var/folders/qt/cvfl_0892yb625qkq7ppt14h0000gq/T/1ac677d46634f25fd48ab67499e3d1e720140515-32533-17br10g'
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/qt/cvfl_0892yb625qkq7ppt14h0000gq/T/c7528087ad463bffc45a3f587db01e0420140515-32533-jzu2d3[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/qt/cvfl_0892yb625qkq7ppt14h0000gq/T/c7528087ad463bffc45a3f587db01e0420140515-32533-jzu2d3[0]' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
Command :: file -b --mime-type '/var/folders/qt/cvfl_0892yb625qkq7ppt14h0000gq/T/eebe1f6bcaba7765c8e20cc93c4fd8b420140515-32533-sfvsxj'
asecondwill commented 10 years ago

Just noticed this is closed. should i post this all in a new ticket? sorry, my bad.