Centos, Rails, Refinery CMS and dragon fly not playing well

198 views
Skip to first unread message

Mudi Ugbowanko

unread,
Feb 20, 2012, 5:49:42 PM2/20/12
to Dragonfly
I have all the dependancies installed (or I think I do). I definitely
have ImageMagick installed, however when using Refinery(v2.9 on rails
3.2) to upload images, I get the following error:

NoMethodError (undefined method downcase' for nil:NilClass): dragonfly
(0.9.10) lib/dragonfly/image_magick/utils.rb:26:inidentify' ....

I am running my app on centos 5.6. I have installed ImageMagick but
this error seems to be popping up on:
lib/dragonfly/image_magick/utils.rb:26

Is this to do with my installation or my server or app?

It all works as it should locally on my mac.

Any help would be much appreciated.

Thanks

M.

Walter Lee Davis

unread,
Feb 20, 2012, 5:56:21 PM2/20/12
to dragonf...@googlegroups.com

On Feb 20, 2012, at 5:49 PM, Mudi Ugbowanko wrote:

> I have all the dependancies installed (or I think I do). I definitely
> have ImageMagick installed, however when using Refinery(v2.9 on rails
> 3.2) to upload images, I get the following error:
>
> NoMethodError (undefined method downcase' for nil:NilClass): dragonfly
> (0.9.10) lib/dragonfly/image_magick/utils.rb:26:inidentify' ....
>
> I am running my app on centos 5.6. I have installed ImageMagick but
> this error seems to be popping up on:
> lib/dragonfly/image_magick/utils.rb:26
>
> Is this to do with my installation or my server or app?

It's not clear from your error message, it sounds like the image isn't being passed to identify correctly. The downcase part is from a part of the code where the file-type extension is being checked, IIRC. Does the file in question have an extension?

>
> It all works as it should locally on my mac.

Does it work with the same file you're hitting this error with?

>
> Any help would be much appreciated.

On your Mac, in Terminal, type 'which identify' and do the same in a shell on your server. Compare the paths to the command. I have had to do a work-around in dragonfly.rb before on one of my servers:

c.convert_command = Rails.env.development? ? "/usr/local/bin/convert" : "/usr/bin/convert"
c.identify_command = Rails.env.development? ? "/usr/local/bin/identify" : "/usr/bin/identify"

Walter

>
> Thanks
>
> M.

Mudiagahn Ugbowanko

unread,
Feb 20, 2012, 5:58:10 PM2/20/12
to dragonf...@googlegroups.com
yes I have tested it out with .jpg and .png.

Shall I post the whole error dump? with the post variables?

Thanks

M.

Mudi Ugbowanko
Technical Director

lemonSkip Media Ltd., Sylvan Grove, Unit 18, London, SE15 1PD

[m] 07880 790 331
[t] 020 3372 0525
[w] www.lemonskip.com 




This e-mail and its contents are intended for the use of the addressee(s) and may be confidential/privileged. No one else may review, copy, disclose or otherwise use it or its contents. If you receive this e-mail in error, please contact the originator and delete it as soon as possible. lemonSkip Media Ltd is registered in England No. 07132861.

Mudiagahn Ugbowanko

unread,
Feb 20, 2012, 6:00:09 PM2/20/12
to dragonf...@googlegroups.com
Started PUT "/refinery/images/5" for 93.97.183.10 at 2012-02-20 17:48:27 +0000
Processing by Refinery::Admin::ImagesController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"zjiQyDF9n83TqQb0Tvmgy1PaVPKq0SdcdlLSW9py3oU=", "image"=>{"image"=>#<ActionDispatch::Http::UploadedFile:0x0000002072d0d8 @original_filename="Audio_Icon.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"image[image]\"; filename=\"Audio_Icon.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/tmp/RackMultipart20120220-2587-1lnqcj>>}, "wymeditor"=>"", "id"=>"5", "locale"=>:en}
Completed 500 Internal Server Error in 56ms

NoMethodError (undefined method `downcase' for nil:NilClass):

dragonfly (0.9.10) lib/dragonfly/image_magick/utils.rb:26:in `identify'
dragonfly (0.9.10) lib/dragonfly/image_magick/analyser.rb:42:in `format'
dragonfly (0.9.10) lib/dragonfly/function_manager.rb:39:in `call'
dragonfly (0.9.10) lib/dragonfly/function_manager.rb:39:in `block (2 levels) in call_last'
dragonfly (0.9.10) lib/dragonfly/function_manager.rb:38:in `catch'
dragonfly (0.9.10) lib/dragonfly/function_manager.rb:38:in `block in call_last'
dragonfly (0.9.10) lib/dragonfly/function_manager.rb:37:in `each'
dragonfly (0.9.10) lib/dragonfly/function_manager.rb:37:in `call_last'
dragonfly (0.9.10) lib/dragonfly/analyser.rb:25:in `analyse'
dragonfly (0.9.10) lib/dragonfly/job.rb:247:in `analyse'
dragonfly (0.9.10) lib/dragonfly/job.rb:193:in `format'
dragonfly (0.9.10) lib/dragonfly/job.rb:197:in `mime_type'
dragonfly (0.9.10) lib/dragonfly/active_model_extensions/attachment.rb:239:in `block in set_magic_attributes'
dragonfly (0.9.10) lib/dragonfly/active_model_extensions/attachment.rb:239:in `each'
dragonfly (0.9.10) lib/dragonfly/active_model_extensions/attachment.rb:239:in `set_magic_attributes'
dragonfly (0.9.10) lib/dragonfly/active_model_extensions/attachment.rb:54:in `assign'
dragonfly (0.9.10) lib/dragonfly/active_model_extensions/class_methods.rb:22:in `block (3 levels) in register_dragonfly_app'
activerecord (3.2.1) lib/active_record/attribute_assignment.rb:85:in `block in assign_attributes'
activerecord (3.2.1) lib/active_record/attribute_assignment.rb:78:in `each'
activerecord (3.2.1) lib/active_record/attribute_assignment.rb:78:in `assign_attributes'
activerecord (3.2.1) lib/active_record/persistence.rb:212:in `block in update_attributes'
activerecord (3.2.1) lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/database_statements.rb:190:in `transaction'
activerecord (3.2.1) lib/active_record/transactions.rb:208:in `transaction'
activerecord (3.2.1) lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
activerecord (3.2.1) lib/active_record/persistence.rb:211:in `update_attributes'
(eval):58:in `update'
actionpack (3.2.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.1) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.1) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.1) lib/active_support/callbacks.rb:524:in `_run__1809371609640341194__process_action__1504515225457778696__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.1) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.1) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.1) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/params_wrapper.rb:205:in `process_action'
activerecord (3.2.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.1) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.1) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.1) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.1) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.1) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:66:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:66:in `dispatch'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:30:in `call'
journey (1.0.1) lib/journey/router.rb:68:in `block in call'
journey (1.0.1) lib/journey/router.rb:56:in `each'
journey (1.0.1) lib/journey/router.rb:56:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:589:in `call'
railties (3.2.1) lib/rails/engine.rb:479:in `call'
railties (3.2.1) lib/rails/railtie/configurable.rb:30:in `method_missing'
journey (1.0.1) lib/journey/router.rb:68:in `block in call'
journey (1.0.1) lib/journey/router.rb:56:in `each'
journey (1.0.1) lib/journey/router.rb:56:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:589:in `call'
sass (3.1.15) lib/sass/plugin/rack.rb:54:in `call'
warden (1.1.1) lib/warden/manager.rb:35:in `block in call'
warden (1.1.1) lib/warden/manager.rb:34:in `catch'
warden (1.1.1) lib/warden/manager.rb:34:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:35:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/cookies.rb:338:in `call'
dragonfly (0.9.10) lib/dragonfly/cookie_monster.rb:9:in `call'
activerecord (3.2.1) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `_run__2415529902263440851__call__1813905488215131179__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
dragonfly (0.9.10) lib/dragonfly/middleware.rb:13:in `call'
rack-cache (1.1) lib/rack/cache/context.rb:132:in `forward'
rack-cache (1.1) lib/rack/cache/context.rb:139:in `pass'
rack-cache (1.1) lib/rack/cache/context.rb:151:in `invalidate'
rack-cache (1.1) lib/rack/cache/context.rb:70:in `call!'
rack-cache (1.1) lib/rack/cache/context.rb:50:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.1) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
rack-cache (1.1) lib/rack/cache/context.rb:132:in `forward'
rack-cache (1.1) lib/rack/cache/context.rb:139:in `pass'
rack-cache (1.1) lib/rack/cache/context.rb:151:in `invalidate'
rack-cache (1.1) lib/rack/cache/context.rb:70:in `call!'
rack-cache (1.1) lib/rack/cache/context.rb:50:in `call'
railties (3.2.1) lib/rails/engine.rb:479:in `call'
railties (3.2.1) lib/rails/application.rb:220:in `call'
railties (3.2.1) lib/rails/railtie/configurable.rb:30:in `method_missing'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/utils.rb:479:in `safe_fork'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:180:in `start'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
<internal:prelude>:10:in `synchronize'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/usr/local/rvm/gems/ree-1.8.7-2012.01/gems/passenger-3.0.11/helper-scripts/passenger-spawn-server:99:in `<main>'

Walter Lee Davis

unread,
Feb 20, 2012, 6:00:09 PM2/20/12
to dragonf...@googlegroups.com

On Feb 20, 2012, at 5:58 PM, Mudiagahn Ugbowanko wrote:

> yes I have tested it out with .jpg and .png.
>
> Shall I post the whole error dump? with the post variables?

Couldn't hurt.

>
> Thanks
>
> M.
>
> On 20 Feb 2012, at 22:56, Walter Lee Davis wrote:
>
>>
>> On Feb 20, 2012, at 5:49 PM, Mudi Ugbowanko wrote:
>>
>>> I have all the dependancies installed (or I think I do). I definitely
>>> have ImageMagick installed, however when using Refinery(v2.9 on rails
>>> 3.2) to upload images, I get the following error:
>>>
>>> NoMethodError (undefined method downcase' for nil:NilClass): dragonfly
>>> (0.9.10) lib/dragonfly/image_magick/utils.rb:26:inidentify' ....
>>>
>>> I am running my app on centos 5.6. I have installed ImageMagick but
>>> this error seems to be popping up on:
>>> lib/dragonfly/image_magick/utils.rb:26
>>>
>>> Is this to do with my installation or my server or app?
>>
>> It's not clear from your error message, it sounds like the image isn't being passed to identify correctly. The downcase part is from a part of the code where the file-type extension is being checked, IIRC. Does the file in question have an extension?
>>
>>>
>>> It all works as it should locally on my mac.
>>
>> Does it work with the same file you're hitting this error with?
>>
>>>
>>> Any help would be much appreciated.
>>
>> On your Mac, in Terminal, type 'which identify' and do the same in a shell on your server. Compare the paths to the command. I have had to do a work-around in dragonfly.rb before on one of my servers:
>>
>> c.convert_command = Rails.env.development? ? "/usr/local/bin/convert" : "/usr/bin/convert"
>> c.identify_command = Rails.env.development? ? "/usr/local/bin/identify" : "/usr/bin/identify"

what do you see when you do this part?

Walter

>>
>> Walter
>>
>>>
>>> Thanks
>>>
>>> M.
>>
>
> Mudi Ugbowanko
> Technical Director
>
> lemonSkip Media Ltd., Sylvan Grove, Unit 18, London, SE15 1PD
>
> [m] 07880 790 331
> [t] 020 3372 0525
> [w] www.lemonskip.com
>
>
>

> <2448y04.jpg>

Mudi Ugbowanko

unread,
Feb 21, 2012, 2:22:28 PM2/21/12
to Dragonfly
Hi,

Not sure if the error dump helps much.

I did some further digging (sorry) and decided to run the following
code:
abort YAML::dump( raw_identify(temp_object).scan(/([A-Z0-9]+) (\d+)x(\d
+) .+ (\d+)-bit/) )

On my Centos box I get an empty string but on my local copy I get the
following:
---
- - JPEG
- '500'
- '500'
- '8'

This I assume is right since I can upload images locally.

However online on my Centos 5.6, Rails 3.2 + RefineryCMS, Apache
+Passenger server ... it fails.

Any ideas on this?

Thanks

M.

Mudi Ugbowanko

unread,
Feb 21, 2012, 3:48:12 PM2/21/12
to Dragonfly
I thibk I have found the error ... the version of ImageMagic on my
server is v6.2... and DragonFly regex (where the error occurs) does
not match the output of 'identify'

Server: /tmp/RackMultipart20120221-18067-1ua4xsb JPEG 500x500
500x500+0+0 DirectClass 16kb
Mac (local Dev): /tmp/RackMultipart20120221-18067-1ua4xsb JPEG 500x500
500x500+0+0 8-bit DirectClass 16kb

So the solution is to upgrade my server (damn you centos!)

M.

Walter Lee Davis

unread,
Feb 21, 2012, 3:50:23 PM2/21/12
to dragonf...@googlegroups.com

On Feb 21, 2012, at 3:48 PM, Mudi Ugbowanko wrote:

> I thibk I have found the error ... the version of ImageMagic on my
> server is v6.2... and DragonFly regex (where the error occurs) does
> not match the output of 'identify'
>
> Server: /tmp/RackMultipart20120221-18067-1ua4xsb JPEG 500x500
> 500x500+0+0 DirectClass 16kb
> Mac (local Dev): /tmp/RackMultipart20120221-18067-1ua4xsb JPEG 500x500
> 500x500+0+0 8-bit DirectClass 16kb
>
> So the solution is to upgrade my server (damn you centos!)
>
> M.


I had this same problem on a Joyent SmartMachine, which began a several month long rabbit hole adventure with their brand new VM product. Fun times with IM.

Walter

Mudi Ugbowanko

unread,
Feb 21, 2012, 3:56:40 PM2/21/12
to Dragonfly
Do you have any handy straight forward guide to install
ImageMagick ... as its is proving stupidly not straight forward ...
issue after issue

Philip Arndt

unread,
Feb 21, 2012, 3:57:45 PM2/21/12
to dragonf...@googlegroups.com
Yes, use this:

https://github.com/maddox/magick-installer

Or just 'brew install imagemagick' if you use home-brew

Walter Lee Davis

unread,
Feb 21, 2012, 3:59:08 PM2/21/12
to dragonf...@googlegroups.com
Not on CentOS. I ended up using a new VM with Ubuntu and that was just aptitude update, aptitude install imagemagick.

Walter

Philip Arndt

unread,
Feb 21, 2012, 4:00:41 PM2/21/12
to dragonf...@googlegroups.com
AH, sorry, CentOS!

Tom Caflisch

unread,
Jul 5, 2012, 10:53:32 PM7/5/12
to dragonf...@googlegroups.com
Hi - This may be a dumb question, but to solve this issue, did you end up upgrading your version of centos or did you just upgrade imagemagick?

On Tuesday, February 21, 2012 3:00:41 PM UTC-6, parndt wrote:
AH, sorry, CentOS!

Reply all
Reply to author
Forward
0 new messages