Skip to content

Instantly share code, notes, and snippets.

@leftis
Created August 23, 2012 10:38
Show Gist options
  • Save leftis/3435379 to your computer and use it in GitHub Desktop.
Save leftis/3435379 to your computer and use it in GitHub Desktop.
Image with padding for paperclip versions 2.3.1.1
module Paperclip
class Padder < Thumbnail
def transformation_command
trans = []
trans << " -gravity center"
trans << " -background white"
trans << " -extent " << %["#{geometry_extent}"]
trans = trans.flatten.compact.join(" ")
super << trans
end
def geometry_extent
"#{target_geometry.width.to_i}x#{target_geometry.height.to_i}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment