thoughtbot/paperclip — Issue #752: "convert" fails only when Paperclip runs it
Author: brutuscat
Created: 2012-02-22 14:59:29+00:00
State: open

I have this weird behavior in my production environment only. I really don't know what else to do...

There are some files that are not being "converted" by Paperclip in my production env. These files just work Ok in dev env and via plain execution in the command line in my prod env.

This is the Paperclip error:

```
Command :: identify -format %wx%h '/home/entretenerse/webapps/entretenerse/releases/20120222142507/tmp/stream20120222-16799-h6517r.txt[0]'
Command :: convert '/home/entretenerse/webapps/entretenerse/releases/20120222142507/tmp/stream20120222-16799-h6517r.txt[0]' -resize "90x90^" -unsharp 0x.7 -gravity center -extent 90x90 '/home/entretenerse/webapps/entretenerse/releases/20120222142507/tmp/stream20120222-16799-h6517r20120222-16799-1yalfzi.gif'
[paperclip] An error was received while processing: #
```

This is the convert error:
```
convert: invalid argument for option `90x90^': -resize.
```
Note how weird is it that it thinks that ```90x90^```is the option and ```-resize``` is the argument.

I'm very very puzzled about this because If I run the command manually it works wonderfully. So it seems that somehow when Cocaine runs the command it mixes the arguments or something is missing there...

This are my files with STI

```ruby
class Asset < ActiveRecord::Base
belongs_to :assetable, :polymorphic => true
delegate :url, :to => :resource
delegate :name, :to => :assetable

Paperclip.interpolates :clean_name do |attachment, style|
attachment.instance.name.gsub(/([#{URI::REGEXP::PATTERN::RESERVED}\/])+?/){'-'}
end

def attachable_type=(sType)
super(sType.to_s.classify.constantize.base_class.to_s)
end

end
```

```ruby
class Event::Image < Asset
has_attached_file :resource,
:styles => {
:thumb => ['90x90^', :gif],
:small => ['90x90', :gif],
:medium => ['210', :png],
:large => ['330x230', :png] },
:url => "/system/:class/:attachment/:style/:id-:clean_name.:extension",
:path => ":rails_root/public/system/:class/:attachment/:style/:id-:clean_name.:extension",
:convert_options => {
:thumb => [" -unsharp 0x.7 -gravity center -extent 90x90"],
:small => [" -thumbnail 8100@ -unsharp 0x.7 -gravity center -background white -extent 90x90"],
:medium => [" -unsharp 0x.9 "]}
end
```