Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Just a bit confused about website images and what gets transferred over the internet.

Laugh all want; I am not a web developer so I don't know this stuff.

If website has an image that is originally 20,000 by 5,000 pixels but reduced by means of CSS to 200 by 50 which image is actually transferred over the internet? Is it the original rendered smaller client side or is the reduced server side and then transferred?

The reason I ask is because we have a large repository of high-res images which need to be displayed in 4 different sizes (search results, catalogue, product and extra large). These are all returned by an AJAX call and I need to know if it is better to generate all 4 versions of the same image on our server or just let the HTML/CSS do its thing.

Thanks

What I have tried:

On a web page I compared the image size by right clicking and looking at the properties and then saving it locally. Both come out with different dimensions!
Posted
Updated 18-Nov-16 5:00am

1 solution

CSS is a client side process and therefore cannot affect what the server does. So, the entire image is sent to the client and then browser scales it up or down depending on what the html/css says to do.

If your original image is 200 pixels by 200 pixels, that entire picture is sent to the client. If the html says to display it 50 x 50, then it is scaled down but is still the original picture. If you right-clicked on the picture and opened in new tab you'd see the original picture.
 
Share this answer
 
Comments
dnibbo 18-Nov-16 11:15am    
Thank you that make perfect sense when you say it like that.
ZurdoDev 18-Nov-16 11:27am    
You're welcome. There are tools that you can use to scale images live on the server. You'd have to google for them. I used ImageGlue.net years ago and made it so when users uploaded images, we then scaled them out to the different sizes we needed and stored them separately.

It all depends on what your needs are.
dnibbo 18-Nov-16 11:50am    
Thanks, interesting looking bit of software.
I thought I would write my own server task to scan the folder for changes and generate the 3 different sizes I need. I can crop any whitespace at the same time also.
ZurdoDev 18-Nov-16 11:55am    
Go for it. Sounds good.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900