High-quality images take time to load on the webpage depending on the number of images.
You can create multiple sizes of the image file when uploading and use the low and high-quality images when required.
When reducing an image size then it also decreases its quality.
The best example of this is WordPress, whenever an image file is uploaded then it will generate a different-different size of the file. Those images will use in the theme according to requirement.
In this tutorial, I show how you can compress image size while uploading with PHP.
Read more