errors creating thumbnails

12 views
Skip to first unread message

shenry

unread,
Dec 29, 2008, 4:20:09 PM12/29/08
to Paperclip Plugin
I'm having trouble creating thumbnails ... I've got whiny_thumbnails
set to true (if I don't explicitly set this it doesn't complain when
the thumbnails fail) and <%= f.error_messages %> in my form.

When I attempt an upload/resize I get the following error:

ActionView::TemplateError (can't convert Array into String) on line #2
of photos/_form.html.erb:
1: <% form_for @photo, :html => { :multipart => true } do |f| -%>
2: <%= f.error_messages %>

Any ideas on how to get the error messages to display so I can figure
out why it's not resizing the thumbnails?

Thanks,

Stu

Jonathan Yurek

unread,
Dec 29, 2008, 5:15:35 PM12/29/08
to papercli...@googlegroups.com
You could try f.error_messages.inspect, but it won't be as pretty.
--
Jonathan Yurek, Founder and CTO
thoughtbot, inc.
organic brains. digital solutions.

617.482.1300 x114
http://www.thoughtbot.com/

shenry

unread,
Dec 29, 2008, 6:10:06 PM12/29/08
to Paperclip Plugin
That returns the same "can't convert array to string" error

Jonathan Yurek

unread,
Dec 29, 2008, 9:06:33 PM12/29/08
to papercli...@googlegroups.com
Really? Then something else is wrong, because #inspect on an Array
returns a String.

shenry

unread,
Dec 30, 2008, 12:16:13 AM12/30/08
to Paperclip Plugin
Thanks for your help on this, Jon. It seems like it's hanging up
before it even hits the #inspect, here is the stacktrace:

ActionView::TemplateError (can't convert Array into String) on line #2
of photos/_form.html.erb:
1: <% form_for @photo, :html => { :multipart => true } do |f| -%>
2: <%= f.error_messages.inspect %>

/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
validations.rb:179:in `+'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
validations.rb:179:in `full_messages'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
validations.rb:173:in `each'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
validations.rb:173:in `full_messages'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
validations.rb:172:in `each_key'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
validations.rb:172:in `full_messages'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
helpers/active_record_helper.rb:173:in `error_messages_for'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/
core_ext/enumerable.rb:50:in `map'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/
core_ext/enumerable.rb:50:in `sum'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
helpers/active_record_helper.rb:173:in `error_messages_for'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
helpers/form_helper.rb:745:in `error_messages'
app/views/photos/_form.html.erb:2:in
`_run_erb_47app47views47photos47_form46html46erb'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
helpers/form_helper.rb:317:in `fields_for'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
helpers/form_helper.rb:253:in `form_for'
app/views/photos/_form.html.erb:1:in
`_run_erb_47app47views47photos47_form46html46erb'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
base.rb:338:in `send'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
base.rb:338:in `execute'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
template_handlers/compilable.rb:29:in `send'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
template_handlers/compilable.rb:29:in `render'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
partial_template.rb:20:in `render'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
benchmarking.rb:30:in `benchmark'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
partial_template.rb:19:in `render'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
template.rb:22:in `render_template'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
partials.rb:110:in `render_partial'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
base.rb:273:in `render'
app/views/photos/new.html.erb:1:in
`_run_erb_47app47views47photos47new46html46erb'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
base.rb:338:in `send'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
base.rb:338:in `execute'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
template_handlers/compilable.rb:29:in `send'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
template_handlers/compilable.rb:29:in `render'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
template.rb:35:in `render'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
template.rb:22:in `render_template'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/
base.rb:245:in `render_file'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
base.rb:1108:in `render_for_file'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
base.rb:865:in `render_with_no_layout'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
base.rb:880:in `render_with_no_layout'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
layout.rb:251:in `render_without_benchmark'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
benchmarking.rb:51:in `render'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/
core_ext/benchmark.rb:8:in `realtime'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
benchmarking.rb:51:in `render'
app/controllers/photos_controller.rb:17:in `create'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
base.rb:1162:in `send'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
base.rb:1162:in `perform_action_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
filters.rb:580:in `call_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
filters.rb:573:in `perform_action_without_benchmark'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
benchmarking.rb:68:in `perform_action_without_rescue_without_timeout'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
benchmarking.rb:68:in `perform_action_without_rescue_without_timeout'
/home/userapps_plugins/preload/request_timeout/lib/
request_timeout.rb:9:in `perform_action_without_rescue'
/usr/lib/ruby/1.8/timeout.rb:48:in `timeout'
/home/userapps_plugins/preload/request_timeout/lib/
request_timeout.rb:8:in `perform_action_without_rescue'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
rescue.rb:201:in `perform_action_without_caching'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
caching/sql_cache.rb:13:in `perform_action'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
connection_adapters/abstract/query_cache.rb:33:in `cache'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
query_cache.rb:8:in `cache'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
caching/sql_cache.rb:12:in `perform_action'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
base.rb:529:in `send'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
base.rb:529:in `process_without_filters'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
filters.rb:569:in `process_without_session_management_support'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
session_management.rb:130:in `process'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
base.rb:389:in `process'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
dispatcher.rb:149:in `handle_request'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
dispatcher.rb:107:in `dispatch'
/usr/lib/ruby/1.8/thread.rb:135:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
dispatcher.rb:104:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
dispatcher.rb:120:in `dispatch_cgi'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/
dispatcher.rb:35:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/thin-0.8.2/lib/rack/adapter/rails.rb:
54:in `serve_rails'
/usr/lib/ruby/gems/1.8/gems/thin-0.8.2/lib/rack/adapter/rails.rb:
74:in `call'
/home/heroku_rack/lib/toolbar.rb:15:in `call'
/home/heroku_rack/lib/static_assets.rb:9:in `call'
/usr/lib/ruby/gems/1.8/gems/rack-0.4.0/lib/rack/urlmap.rb:42:in
`call'
/usr/lib/ruby/gems/1.8/gems/rack-0.4.0/lib/rack/urlmap.rb:35:in
`each'
/usr/lib/ruby/gems/1.8/gems/rack-0.4.0/lib/rack/urlmap.rb:35:in
`call'
/usr/lib/ruby/gems/1.8/gems/rack-0.4.0/lib/rack/builder.rb:53:in
`call'
/usr/lib/ruby/gems/1.8/gems/thin-0.8.2/lib/thin/connection.rb:
59:in `pre_process'
/usr/lib/ruby/gems/1.8/gems/thin-0.8.2/lib/thin/connection.rb:
50:in `process'
/usr/lib/ruby/gems/1.8/gems/thin-0.8.2/lib/thin/connection.rb:
35:in `receive_data'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.0/lib/
eventmachine.rb:224:in `run_machine'
/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.0/lib/
eventmachine.rb:224:in `run'
/usr/lib/ruby/gems/1.8/gems/thin-0.8.2/lib/thin/backends/base.rb:
45:in `start'
/usr/lib/ruby/gems/1.8/gems/thin-0.8.2/lib/thin/server.rb:146:in
`start'
/usr/lib/ruby/gems/1.8/gems/thin-0.8.2/lib/thin/controllers/
controller.rb:79:in `start'
/usr/lib/ruby/gems/1.8/gems/thin-0.8.2/lib/thin/runner.rb:166:in
`send'
/usr/lib/ruby/gems/1.8/gems/thin-0.8.2/lib/thin/runner.rb:166:in
`run_command'
/usr/lib/ruby/gems/1.8/gems/thin-0.8.2/lib/thin/runner.rb:136:in
`run!'
/usr/lib/ruby/gems/1.8/gems/thin-0.8.2/bin/thin:6
/usr/bin/thin:19:in `load'
/usr/bin/thin:19

am I correct in believing that the + method in validations.rb is
throwing the error as it's building the array of errors? This error is
happening while running on heroku which has RMagick and ImageMagick
installed on their system, so I'm not sure if paperclip knows how to
find those resources and therefore not creating thumbnails and
throwing the exception?

Also, I only get these exceptions if I explicitly set whiny_thumbnails
=> true or validates_attachment_thumbnails :photo ... shouldn't
paperclip default to whiny_thumbnails => true? I've got the plugin v.
2.1.5

Thanks again,

Stu

shenry

unread,
Dec 31, 2008, 12:01:32 AM12/31/08
to Paperclip Plugin
I believe the error causing the thumbnail failure is:

/tmp/stream.24992.0 is not recognized by the 'identify' command

any ideas? Thanks,

Stu
> ...
>
> read more »

shenry

unread,
Dec 31, 2008, 12:54:37 AM12/31/08
to Paperclip Plugin
from the console of the heroku app:

>> identify /tmp/stream.24992.0
SyntaxError: compile error
/home/heroku_rack/lib/init.rb:1: unknown regexp options - tra
/home/heroku_rack/lib/init.rb:1: no .<digit> floating literal anymore;
put 0 before dot
identify /tmp/stream.24992.0
^
/home/heroku_rack/lib/init.rb:1: syntax error, unexpected tFLOAT
identify /tmp/stream.24992.0
^

Not sure if this is helpful or not in figuring out where the issue
might be... any help is appreciated.

Thanks,

Stu
> ...
>
> read more »

Jonathan Yurek

unread,
Dec 31, 2008, 9:39:13 AM12/31/08
to papercli...@googlegroups.com
That's... weird. Is it trying to run the identify command as ruby?
That's what it looks like it's trying to do.

Have you contacted heroku support about this at all?

Josh Schairbaum

unread,
Dec 31, 2008, 11:00:50 AM12/31/08
to Paperclip Plugin
FWIW, I am receiving this same error on my Mac. I followed the
directions on the RMagick page to install ImageMagick from ports, and
I believe I've had it work before w/ paperclip. My app is running
passenger.

[paperclip] Paperclip attachment picture on Photo initialized.
[paperclip] Assigning #<File:/tmp/CGI.57760.2> to picture
[paperclip] Writing attributes for picture
[paperclip] Post-processing picture
[paperclip] Processing medium #<File:0x5791224> in the thumbnail
processor.
[paperclip] An error was received while processing:
#<Paperclip::NotIdentifiedByImageMagickError: /tmp/stream.57760.0 is
not recognized by the 'identify' command.>

Running the identify command on the original file returns the proper
value.

Regards,
Josh
> ...
>
> read more »

Henrik Nyh

unread,
Dec 31, 2008, 12:34:35 PM12/31/08
to papercli...@googlegroups.com
I'm running on OS X with Passenger and it works fine. Don't have full
thread history, so it's probably been mentioned before by me or
someone else, but did you try configuring the full ImageMagick path?
Has been mentioned several times before on the list, search for more
info.

Happy new year!

shenry

unread,
Dec 31, 2008, 12:54:34 PM12/31/08
to Paperclip Plugin
Thanks for the replies, everyone.

Ive got this working fine on my mac, it's just on the heroku deploy
that the problem arises. I've contacted them regarding to problem too.

Happy new year!

Stu

On Dec 31, 9:34 am, "Henrik Nyh" <hen...@nyh.se> wrote:
> I'm running on OS X with Passenger and it works fine. Don't have full
> thread history, so it's probably been mentioned before by me or
> someone else, but did you try configuring the full ImageMagick path?
> Has been mentioned several times before on the list, search for more
> info.
>
> Happy new year!
>
> On Wed, Dec 31, 2008 at 5:00 PM, Josh Schairbaum
>
> ...
>
> read more »

Josh Schairbaum

unread,
Dec 31, 2008, 1:27:05 PM12/31/08
to Paperclip Plugin
Henrik,

I can set it explicitly, but I was trying to set it dynamically and it
was failing. For example, in RAILS_ROOT/config/initializers/
paperclip.rb:

image_magick_path= `/usr/bin/which identify`.strip.chomp("/identify")
Paperclip.options[:command_path] = image_magick_path

Passenger chokes on the `which` command, of course it works from the
console, and I would assume also mongrel, which I think runs as me.
It's not a public project, so I can just set it explicitly.

Regards,
Josh
> ...
>
> read more »

Henrik Nyh

unread,
Dec 31, 2008, 7:27:57 PM12/31/08
to papercli...@googlegroups.com
On Wed, Dec 31, 2008 at 7:27 PM, Josh Schairbaum
<mailin...@joshuaschairbaum.com> wrote:
> I can set it explicitly, but I was trying to set it dynamically and it
> was failing. For example, in RAILS_ROOT/config/initializers/
> paperclip.rb:
>
> image_magick_path= `/usr/bin/which identify`.strip.chomp("/identify")
> Paperclip.options[:command_path] = image_magick_path

No big wonder -- `which` searches the PATH :) And the reason you need
to set the IM path explicitly is that it wasn't there.

Reply all
Reply to author
Forward
0 new messages