Find image height without it being set in HTML
I have found how to find the height of an image, but it seems to rely on the number that is set with the HTML height attribute.
Is there a way to find the height of an image on the page if it is not set with HTML (using a CMS that isn't setting the height with HTML, don't yell at me for not doing it).
My ultimate goal is to find the height of the tallest image in a group of images, so that I can set a height on the "col" div so that they align properly, so if you want to help with that. Otherwise I just need to know how to get this height and I will figure out the rest.
<div class="col" style="border: 1px solid">
<a style="text-decoration: none;" href="/straight-razors.html">
<img border="0" src="straightrazors__83594.gif">
The height is readable provided that the image has loaded.
If you load into an <img> tag, the true dimensions are overridden by the height/width attributes if set.
If you need to get true dimensions under any circumstances, load into an Image() object and use its onload event to read or signal the readability of dimensions.
Install your onload event handler before applying the src property.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)