javascript - The image's dimension is different from when it's loading and after it loads -


I have a page that loads large images (about 200 to 100 KB images [about 600 x 400 px ]).

Unlike the scenario, if I am in pictures, then I am trying to manipulate pictures.

The problem I am facing is that when I use javascript to load properties of portrait, then the height is much smaller than that and the width The more you should be. In particular, a 75 x 100 image was considered as 100 x 16. So when this image is run through this image, the image is considered a landscape, not a picture, and it is left over.

I had a hard time trying to identify the problem, as this property shows it as an image of 75 x 100 px after loading.

Is there a way to solve this problem? Or run the function after loading all the images?

Run after the function is loaded, D has to do this:

< Strong> Use of DOM exclusively

  var newImg = document.createElement ('img'); NewImg.src = "theImage.png"; NewImg.alt = "Always specify alternative text for access, even if left blank"; NewImg.onload = function () {// image manipulation}; GalleryNode.appendChild (newImg); // Change galleryNode with the original element of your image  

Use of inner HTML

  galleryNode.innerHTML + = "& Lt; img src = 'theImage.png' alt = '' id = 'newImage1' / & gt; "; Var newImg = document.getElementById ('newImage1'); NewImg.onload = function () {// image manipulation};   

Use of jQuery

  $ ('Gallery IMG'). Live ('load', function () / image manipulation}};  

Comments