April 8, 2019
Get Image Size (Using JQuery)
Sometimes the Quality Assurance team needs to get the size of an image that is rendered on a page. Usually, this is to validate that the rendered image meets the specifications.
This will show you what the image actually rendered on the page:
$imageCheck = "Height: " + $('#facebook').height() + " Width: " + $('#facebook').width() ;
If you want to know the actual physical dimensions of the image:
$NaturalCheck = "Natural Height: " + $('#facebook').naturalHeight() + " Natural Width: " + $('#facebook').naturalWidth() ;
Sample Output
Comments
Add your Comments
Feel free to leave a comment about this post.