How to reduce image loading time in PHP

I am currently developing a site in PHP, where 1000 images are loaded via AJAX on a page. So it takes a lot of time. Is there any optimization technique that can reduce load times. I do not want to change the image quality.

Will image coding be useful?

+4
source share
3 answers

Look at the caching logic for pages. Images can be cached by the web server. Are you using Apache or IIS?

+1
source

Optimization and thoughts on microoptimization:

Reduce image file size

This is perhaps the most important factor to really reduce download time (less to download β†’ faster to complete)

  • use some image optimization services like SmushIt or some local software like IrfanView
  • find out which conversion format is best for
  • try to lose some quality, you will be surprised to see that 1% sometimes has little chance of unbearable losses.
  • delete the MetaData / EXIF ​​image if you do not need it

Web server and hardware

Access time is another important factor.

  • Apache is great, but others may work better for working with image files or small files (e.g. Nginx / lightHTTPd)
  • customize the web server to suit your needs.
  • select very fast storage (use RAM if possible)

Webpage

  • use NeverEndingPage / load-on-scroll or "Click for more information"
  • paginate your image sets (perhaps in importance)
  • make your image containers and links shorter, split the extension, because browsers will get the file type from the file header, rename your files as the base (62) counter versus the usual 1.jpg ... 20000.jpg (for example, <img src = Q8U >)
+1
source

it’s better to display initially 50 images and load the rest while scrolling the page. here is an example of loading a page while scrolling

0
source

All Articles