Paperclip not resizing in Production - need help.

59 views
Skip to first unread message

Wuffo

unread,
Mar 1, 2009, 7:47:23 PM3/1/09
to Paperclip Plugin
Works great in development (Ubuntu, Mongrel), not in production
(Centos, Passenger).

Without :whiny_thumbnails, the original is saved properly, but not the
other sizes specified.

using Paperclip 2.1.2, Rails 2.2.2

I re-installed ImageMagick by hand, and set - Paperclip.options
[:image_magick_path] = "/usr/local/bin"
Error is "Photos is invalid". I see nothing telling in the logs:

Photo Columns (0.6ms) SHOW FIELDS FROM `photos`
[paperclip] Paperclip attachment data on Photo initialized.
[paperclip] Assigning #<File:/tmp/CGI.28459.12> to data
[paperclip] Writing attributes for data
[paperclip] Post-processing data
SQL (0.1ms) BEGIN
CACHE (0.0ms) SELECT * FROM `users` WHERE (`users`.`id` = 15)
Category Load (0.3ms) SELECT * FROM `categories` WHERE
(`categories`.`id` = 65)
SQL (0.0ms) ROLLBACK


Model:
has_attached_file :data, :whiny_thumbnails => true, :swallow_stderr
=> false,
:styles => {
:thumb => "50x50#",
:large => "640x480>"
}

validates_attachment_presence :data
validates_attachment_size :data, :less_than => 2.megabytes
validates_attachment_content_type :data,
:content_type => ['image/jpeg', 'image/pjpeg',
'image/jpg', 'image/png']

Any ideas???

Jonathan Yurek

unread,
Mar 1, 2009, 10:59:04 PM3/1/09
to papercli...@googlegroups.com
As a sanity check, you've checked that IM is installed correctly by
using it from the command line, right?

Also, :swallow_stderr => false needs to be set on Paperclip.options,
not has_attached_file.
--
Jonathan Yurek, Founder and CTO
thoughtbot, inc.
organic brains. digital solutions.

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

Wuffo

unread,
Mar 2, 2009, 5:56:24 AM3/2/09
to Paperclip Plugin
Thanks, Jonathan - your check led me to sanity.

Here's a record of what I did for anyone else with similar problems:
Originally, after installing ImageMagick, I ran 'make check', which
ran tests successfully. I thought all was kosher... It obviously
wasn't.
But now I ran 'display lucy.jpg' which resulted in the error:
error while loading shared libraries: libMagickCore.so.2: cannot open
shared object file: No such file or directory

Found the following solution: 'ldconfig /usr/local/lib' which resulted
in another error:
ldconfig: /usr/local/lib/libtcmalloc_minimal.so.0 is not a symbolic
link

I ignored that and re-ran the display test and got the proper help
text. Also I successfully converted lucy.jpg into lucy.png

In /config/initializers/paperclip.rb I added the line:
'Paperclip.options[:swallow_stderr] = false' (removing my previous
misunderstanding)

Restarted Apache (just to be safe), deployed - with passenger restart
- and got the proper resizing on upload.

:)

Jonathan Yurek

unread,
Mar 2, 2009, 10:12:41 AM3/2/09
to papercli...@googlegroups.com
Excellent! Glad to hear it.
Reply all
Reply to author
Forward
0 new messages