Skip to content

Instantly share code, notes, and snippets.

@over
Created April 20, 2010 12:59
Show Gist options
  • Save over/372397 to your computer and use it in GitHub Desktop.
Save over/372397 to your computer and use it in GitHub Desktop.
def image_tag(source, options = {})
path = File.join(Rails.root, "public", source.gsub(/\?[\d]+/, ''))
if File.exists?(path)
size = ImageSize.new(File.read(path)).get_size.join("x")
options.merge!(:size => size)
end
super(source, options)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment