Created
March 28, 2012 01:21
-
-
Save rafapolo/2222685 to your computer and use it in GitHub Desktop.
Rails image_tag helper with image dimensions
This file contains hidden or 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 image_tag_size i | |
path = CGI::unescape(i.image.url :medium, false) | |
size = Paperclip::Geometry.from_file("#{Rails.root}/public#{path}").to_s | |
image_tag path, :size=>size | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment