We are Commonly download the image from google and Upload it without compressed, Its made a problem while loading the website, Its reduce the page speed, So we need to compress the Image size before upload into your site, So here we go to learn How To Compress Image File Size Using Php,

Step 1 : Create file for Compress Image file size code.

This is just a php function that passes the source image ( i.e., $source_img ), destination image ( $destination_img ) and quality for the image that will take to compress ( i.e., 90 ).
The getimagesize() function is used to find the size of any given image file and return the dimensions along with the file type.

Quality ($quality): quality is optional, and ranges from 0 (worst quality, smaller file) to 100 (best quality, biggest file). The default range is 75.

Step 2 : Create Form For image upolad

This is simple Form code for upload image.

Here you can get Full code.

Associative array is array that use named keys that you assign to them. example

named key ‘raj’ has…