Last active
August 29, 2015 13:57
-
-
Save PaulMaynard/9572416 to your computer and use it in GitHub Desktop.
Checks the size of all images on page to ensure they are the same as the dimensions of the image file
This file contains 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
[].slice.call(document.getElementsByTagName('img')).map(function(i) { | |
var src = i.src, i2 = new Image(); | |
i2.src = src | |
return { | |
src: src, | |
i1: i, | |
i2: i2 | |
} | |
}).filter(function(i) { | |
return !(i.i1.width === i.i2.width || i.i1.height === i.i2.height) | |
}).map(function(i) { | |
return i.i1.alt + ': ' + /^.*\/([^\/]*)$/.exec(i.src)[1] + ", width: " + i.i2.width + ", height: " + i.i2.height | |
}).join('\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment