Right now I am providing an interface on my website to allow users to upload 3 image files. This number may increase in future.
The image filenames are being stored in the database for example
Image1 | Image2 | Image3
cat.jpeg | dog.jpeg | mouse.jpeg
My PHP script then retrieves these filenames from the DB then downloads them to the client machine
- It takes 2s for Jquery to download (0s cached)
- 400ms for PHP script to pull data including the image names
- 2s for the image to download
About 2.4seconds total time to download when cached. Is it possible to speed up this process? Could I store the images on the server named as 1.jpeg, 2.png etc and remove the reference on the DB? Is it best practice to compress images on the server and if so how?