Created
March 29, 2010 18:01
-
-
Save jimneath/348180 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HELP! | |
# | |
# I’ve noticed that imagemagick is hogging a large part of the CPU when calling convert and identify, this in turn means I’m getting errors like this: | |
# | |
# Cannot allocate memory – identify -format “%wx%h” “/tmp/._imagename_01bc_030,17721,0.jpg”0 2>/dev/null /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/kernel/agnostics.rb:7:in ``’ /usr/lib/ruby/gems/1.8/gems/activesupport-2… | |
# | |
# That error is taken from delayed job. | |
# | |
# Is there any way I can stop imagemagick hogging so much cpu via paperclip or am I destined to grin and bare it? | |
class Picture < ActiveRecord::Base | |
# Plugins | |
acts_as_list :scope => :gallery | |
has_attached_file :image, | |
# Amazon S3 | |
:storage => :s3, | |
:bucket => 'images.example.com', | |
:s3_host_alias => 'images.example.com', | |
:s3_credentials => "#{Rails.root}/config/amazon_s3.yml", | |
:s3_permissions => :public_read, | |
:s3_headers => { | |
'Cache-Control' => 'max-age=315360000', | |
'Expires' => 10.years.from_now.httpdate, | |
}, | |
# Paths | |
:url => ':s3_alias_url', | |
:path => ":gallery_id/:style-:id.jpg", | |
# Styles | |
:default_style => :large, | |
:styles => { | |
:large => "640x>", | |
:thumb => "125x125#", | |
:small => "48x48#" | |
}, | |
:convert_options => { :all => '-strip' } | |
] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment