Skip to content

Instantly share code, notes, and snippets.

@gusridd
Last active Jan 27, 2016
Embed
What would you like to do?
Change current web page images by photos of Nicolas Cage
// Get all images
var images = document.getElementsByTagName('img');
for (var i in images){
var img = images[i];
var height = img.height;
var width = img.width;
var url = "https://www.placecage.com/c/" + width + "/" + height;
// Replace an image src by the corresponding placecage url
img.setAttribute('src', url);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment