Created
February 6, 2015 14:52
-
-
Save d-tux/7d56be2464262b7c7d21 to your computer and use it in GitHub Desktop.
Finds the "real" size on an image.
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
| function getImageSize(img) { | |
| var i = $('<img/>') | |
| .css('visibility', 'hidden') | |
| .attr('src', $(img).attr('src')) | |
| .appendTo('body'); | |
| var r = { | |
| width: i.width() | |
| , height: i.height() | |
| }; | |
| i.remove(); | |
| return r; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment