Skip to content

Instantly share code, notes, and snippets.

@gusridd
Last active January 27, 2016 21:23
Show Gist options
  • Save gusridd/28210f77b893d231c0b9 to your computer and use it in GitHub Desktop.
Save gusridd/28210f77b893d231c0b9 to your computer and use it in GitHub Desktop.
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