Php

How To Compress Image File Size Using Php

Google+ Pinterest LinkedIn Tumblr

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.

I'm Rajasekar - Web developer, Freelancer, Blogger and Owner of DeveloperDesks. From India lives in Bahrain. I love to do coding, Creating websites and trying different with code and designs. You Can Hire Me