If you haven't resized the image, you could use.
If you haven't resized the image, you could use: image.width() and image.height().
This is quite similar to the other answers, but I have tested it in IE7, so it might be closer to what you want: $(document). OnImagesLoad({ selectorCallback: function() { $('img'). Each(function(){ alert($(this).width()+', '+$(this).height()); }); } }); See here, this may not be exactly how you were using it, but I'm not familiar with this onImagesLoad thing.
Thanks for the link, but the code there doesn't reflect the scenario. I don't embed the elements into the but instead load() a list of elements from an external . Html file.
I suspect that the additional loading of image elements, embedding them into the DOM, and invoking a callback upon "image ready" (whatever that means for a browser! ) causes the issues I see on different browsers. – Jens Jun 5 '10 at 23:55.
ImageDomElement. Width imageDomElement. Height or try imageDomElement.
ClientWidth imageDomElement.clientHeight.
If you play with jquery, then image. Attr(width) should do the trick But why not using the document. Ready instead, could give you less headeache..
Use the following code instead $(document). OnImagesLoad({ selectorCallback: function() { $('img'). Each(function(){ alert($(this)0.
ClientWidth +', '+$(this)0. ClientHeight); }); } }).
Is there any reason to use $(this)0. ClientWidth instead of this. ClientWidth?
– Ryley Jun 3 '10 at 18:02 Sometimes it doesn't work with IE 7, that why it is used. – Deviprasad Das Jun 4 '10 at 10:34 See my comment above to Ryley's initial post. – Jens Jun 5 '10 at 23:56.
It's been a while but I finally found some time to tinker with this again. The above problems are still there, but here is what I think is going on. When I load the initial images then yes, the file is loaded and image objects are generated.
But it seems that the attributes are not correct yet, and they won't be until the image is actually added to the DOM of the site and rendered. A div/image on hide() on IE has no dimension information whatsoever, on Safari there is some information available. For example, without adding the following div anywhere var test = $("") the image contained there has the following information: width() = 0, attr("width") = 600, css("width") = "", and img0.
ClientWidth = 0. That's on Safari; on IE it's the same except attr("width") = 0 and css("width") = "auto". Now I can't use this, and that's what broke my script and why I posted my initial question.
However, the moment I append this div and have it rendered, all the correct values show up in the image object. I'm writing a little gallery thinghie, which shows whatever images I have in that second . Html file that I load; that gallery, however, computes and places the thumbnails, and prepares the images it shows in full URL1 make this look ok, I basically wanted to create the entire thing hidden, and then fade it in.
Alas, it seems that this whole idea won't pan out. A friend suggested to load everything into a tiny iframe off to the left where it's not visible, and work with that. Perhaps that's the way to go.
Another thing I noticed, and that seems to be very closely related to the aforementioned load issue is clone(). It seems that if an image is rendered, a var newimg = img.clone() generates the same "empty" image object that I have to deal above. Even when the original image is visible and contains all the right attributes, its clone does not.
Right now I don't see any other way than to rethink and rewrite parts of my gallery.
$("#load img"). Each(function() { var img = new Image(); img. Src = this.
Src; alert(img. Height + " x " + img. Width); }).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.