Skip to content

Instantly share code, notes, and snippets.

@neto-developer
Created February 2, 2022 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neto-developer/6314e3a4cbd663c27158fe0791b6a158 to your computer and use it in GitHub Desktop.
Save neto-developer/6314e3a4cbd663c27158fe0791b6a158 to your computer and use it in GitHub Desktop.
Show dimensions of all images on page
$('img').each(function(){
let t = $(this);
let url = `https://dummyimage.com/${Math.round(t.outerWidth())}x${Math.round(t.outerHeight())}/f0f0f0/999`;
console.log(`${Math.round(t.outerWidth())}x${Math.round(t.outerHeight() => ${t.attr('src')}`);
t.attr('src', url);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment