Harshanil
Harshanil

Reputation: 27

Does downsizing an image using height and width attributes of <img> tag in HTML waste bandwidth?

I'va an image 'Angelina.png' having resolution 1000x1000, which is to be rendered as 50x50 on webpage. Does the following have same affect as it would have been for the case if the image itself was 50x50? Or, does it waste the user bandwidth by downloading the original size?
<img src='Angelina.png' width='50px' height='50px' alt='Angelina' />

Upvotes: 0

Views: 218

Answers (3)

kerry
kerry

Reputation: 691

If bandwidth is your concern re-size it server side using php GD before downloading. As Guru Kamar said html is executed client side so image is downloaded then resized. PHP is executed server side so downloaded image would be smaller. Yes it wastes bandwidth.

Upvotes: 0

abksrv
abksrv

Reputation: 1405

Here it goes:

Tip: Downsizing a large image with the height and width attributes forces a user to download the large image (even if it looks small on the page). To avoid this, rescale the image with a program before using it on a page.

See: http://www.w3schools.com/tags/att_img_height.asp

So, the answer is yes, it takes more time to download, wastes bandwidth.

Upvotes: 0

Guru Kumar
Guru Kumar

Reputation: 26

Yes, since you are resizing email on DOM i.e in actual image is downloaded from the server (with the actual size) and you are simply trying to resize it on DOM to improve the UI.

Upvotes: 1

Related Questions