Created
July 15, 2010 21:55
-
-
Save danhixon/477586 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 Cropper < Thumbnail | |
def transformation_command | |
if crop_command | |
cmd = crop_command + super.join(" ").sub(/ -crop \S+/, '') | |
cmd.split(" ") | |
else | |
super | |
end | |
end | |
def crop_command | |
target = @attachment.instance | |
if target.cropping? | |
" -crop '#{target.crop_w.to_i}x#{target.crop_h.to_i}+#{target.crop_x.to_i}+#{target.crop_y.to_i}'" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment