Created
December 23, 2011 21:31
-
-
Save patshaughnessy/1515410 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
def avatar_geometry(style = :original) | |
@geometry ||= {} | |
begin | |
path = avatar.path(style) | |
unless path | |
temp_file = Tempfile.open("#{avatar_file_name}_#{style}") | |
temp_file << avatar.file_contents(style) | |
path = temp_file.path | |
end | |
@geometry[style] ||= Paperclip::Geometry.from_file path | |
ensure | |
temp_file.close if temp_file | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment