I am receiving control of a website and I need to take care of an image compression process.
Right now, when uploading an image, it gets stored on the server with high quality and when the website's being cached, the image is getting compressed for the cache. So the cache has a compressed copy of the image while the original, high quality image, is still stored on the server.
The tool which is responsible of doing what I have just described was developed by the current owner of the website and since I am not getting that tool I will need another one. The site is currently using Pydio
and I have not seen any compression option there.
Since it seems I need a new tool for the image compression process, I want to know first what is the best practice, performance-wise, for handling the compression and I know there some good, experienced developers here.
I thought about some options:
- Keep it the way it is now, which is to store the original image on the server and when caching, compress it for the cache (Best compatibility with the website since this is what the tool currently being used doing).
- Compress all images the moment they are being uploaded and so I will have only the compressed images on the server and use them to cache (Save storage space, but don't know how to combine it with
Pydio
). - Have a cron which will compress all the images which are not already compressed (Gives me the ability to upload images freely without worrying about compressing them, though the images will not be immediately compressed).
- Upload the image to a website which compresses the image and then take the outputted image and upload it (Really, sounds stupid and a lot of messing around in order to upload an image)..
What do you think will be the best practice, and why? Also, Is there a better practice for compressing the images?
Plus, if you know any tool which has an API for it or anything, I will be thankful to hear about it.
The website is built using PHP.