Skip to content

Instantly share code, notes, and snippets.

@jalbertbowden
Created March 29, 2013 22:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jalbertbowden/5273983 to your computer and use it in GitHub Desktop.
Save jalbertbowden/5273983 to your computer and use it in GitHub Desktop.
NaturalWidth and NaturalHeight in IE7 and IE8 via http://www.jacklmoore.com/notes/naturalwidth-and-naturalheight-in-ie/
function getNatural (DOMelement) {
var img = new Image();
img.src = DOMelement.src;
return {width: img.width, height: img.height};
}
var
natural = getNatural(document.getElementById('example')),
nWidth = natural.width,
nHeight = natural.height;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment