Skip to content

Instantly share code, notes, and snippets.

@splendeo
Forked from amasses/gallery_images_controller.rb
Created November 19, 2009 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save splendeo/238906 to your computer and use it in GitHub Desktop.
Save splendeo/238906 to your computer and use it in GitHub Desktop.
Modified the order so rotation happens before resizing
module Paperclip
class Rotator < Thumbnail
def transformation_command
if rotate_command
# having the "super" at the end ensures that your thumbnails are allways "inside the limits of your styles"
rotate_command + super
else
super
end
end
def rotate_command
target = @attachment.instance
if target.rotating?
" -rotate #{target.rotation}"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment