Skip to content

Instantly share code, notes, and snippets.

@urbanautomaton
Created January 26, 2011 19:56
Show Gist options
  • Save urbanautomaton/797320 to your computer and use it in GitHub Desktop.
Save urbanautomaton/797320 to your computer and use it in GitHub Desktop.
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
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