0

I was wondering, is it possible to enhance the speed of a page loading by decreasing the size of images within the page?

For example, i currently have a large image (1200x 1200) which i need to be fitted to 100x100. Would this be possible via jQuery or would it have to be done manually?

Thanks.

Oliver Kucharzewski
  • 2,523
  • 4
  • 27
  • 51

4 Answers4

1

You would have to change your image sizes on the server and then change the page HTML or javascript to reference those smaller images. jQuery runs in the browser so, it can't take a 1200x1200 image on the server and somehow make it 100x100 before it gets downloaded.

But, changing the images to the smaller size on the server WILL drastically improve your page load time.

jfriend00
  • 683,504
  • 96
  • 985
  • 979
0

Yes it certainly will increase your page load speed.

And, resizing the image on the server is a better option.

reference:

Should I generate each thumbnail dynamically every time it is requested, or store them on image upload?

Community
  • 1
  • 1
Hendyanto
  • 335
  • 1
  • 8
0

To resize images server-side, you can use WideImage library. With an instruction like this :

WideImage::load($path)
    ->resize(100, 100)
    ->output("jpg");

You load your image, resize it in memory and return its data in the desired format.

Nico
  • 115
  • 1
  • 3
  • 9
0

I was wondering, is it possible to enhance the speed of a page loading by decreasing the size of images within the page? Would this be possible via jQuery

No. This would require that the browser download the large image over the network and then process it to reduce it in size.

If you want to speed things up, you need to make the images smaller before they leave the server.

You don't need to do this manually though. Image resizing can be done programatically.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335