Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If a user uploads a 2000x2000 px image and then I display it as 400x400 px, does the page use bandwidth as if the image is 2000x2000px?

Tags:

html

css

I am creating a website where people can upload images which are then shown on the index page, however, I've been wondering whether displaying 2000x2000px image in tag whose width and height is set to 400x400px slows down the loading time of the page/images.

like image 600
Bobimaru Avatar asked May 25 '18 09:05

Bobimaru


1 Answers

Yes, the image will still need to be transmitted over the network in it's entirety before the client (browser) can scale it down.

Unless there is some server-side scaling done, the webserver doesn't know (and has no way to know) what size the user is expecting so it will simply serve up the file as uploaded and the client (browser) will scale it to the desired size. You can check this, as @l3fty points out, by right-clicking the image and viewing it or by entering the images' url directly into the addressbar.

Some CMS'es or other applications might scale your image server-side when uploaded or on demand but this depends on the application, it's configuration etc.

like image 51
RobIII Avatar answered Oct 07 '22 20:10

RobIII