QA Graphic

Get Image Size (Using JQuery)

Finding the rendered 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

Natural Height Check

 

About

jQuery is the most popular Javascript library on the Internet. Chances are that websites that your testing use it. These posts are all about tips and tricks for QA testing.

Schedule

SaturdayInternet Tools
SundayOpen Topic
MondayMedia Monday
TuesdayQA
WednesdayAffinity
ThursdayBBEdit
FridayMacintosh