Created
January 26, 2011 19:56
-
-
Save urbanautomaton/797320 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
module Paperclip | |
class Padder < Thumbnail | |
def transformation_command | |
super + ["-gravity center", | |
"-background white", | |
"-extent", %["#{geometry_extent}"]] | |
end | |
def geometry_extent | |
"#{target_geometry.width.to_i}x#{target_geometry.height.to_i}" | |
end | |
end | |
end |
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
class User < ActiveRecord::Base | |
has_attached_file :image, | |
:styles => { | |
:small => "50x50", | |
:medium => "130x130>", | |
:large => "280x280>", | |
:haystacks => "330x330>" }, | |
:processors => [:padder] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment