Skip to content

Instantly share code, notes, and snippets.

@baladkb
Created July 6, 2017 09:44
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 baladkb/60000e21b700497adc8f56538d72b2bb to your computer and use it in GitHub Desktop.
Save baladkb/60000e21b700497adc8f56538d72b2bb to your computer and use it in GitHub Desktop.
get Height / Width of image in JavaScript
var imageVal = urlVal+'/images/articulos-nuevo/'+siteVal+'/'+codigoAlfa+'/1-Z.jpg';
var img = new Image();
img.onload = function(){
var height = img.height;
var width = img.width;
console.log("::: height "+height);
console.log("::: width "+width);
}
img.src = imageVal;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment