We as developers usually get complaints from our client that the Media files are consuming lot of space than they should on the server resulting in choking the bandwidth of the server which in turns make website slow to load the main reason for this is “Uploading of huge media files especially images by the users on the website”. Now there are 2 scenarios by avoiding uploading of huge images on the website.
- First is to put the size limitation while uploading the file which is not as user-friendly since the user will have to compress the image or find some other alternative solution.
- The smart option is to compress the size of the image to the figure required by you automatically while uploading which will result in a smaller image acquiring less space on the server.
So today we have a quick hack on how you can compress the size of the image and upload it to the server as well as your database.
So lets start
- First let us create a simple form which from where we will upload the files
PHP Hurdles Image Compression