Skip to content

Instantly share code, notes, and snippets.

@rafapolo
Created March 28, 2012 01:21
Show Gist options
  • Save rafapolo/2222685 to your computer and use it in GitHub Desktop.
Save rafapolo/2222685 to your computer and use it in GitHub Desktop.
Rails image_tag helper with image dimensions
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