Convert Image to JPG, PNG & GIF in PHP

Here i’m coming up with a new PHP class, which will help you to convert any uploaded image to JPG, PNG and GIF.

Class name: image_converter.php

See the Demo or Download the PHP image converter script here:

 demodownload

 

 

Converter Function in the Image_converter class is:

convert_image() has 3 mandatory parameters
* $convert_type => accepts string either ‘png’, ‘jpg’ or ‘gif’
* $target_dir => it is the source as well as the target directory
* $image_name => give the actual image name such as ‘image1.jpg’
*
* //optional parameter
* $image_quality => can be adjusted, if you don’t want 100% quality

Here is the complete usage of the above PHP class, which includes image upload and image conversion script.

index.php – Uploads the image.

 convert.php – Convert the image.

 download.php – downloads the converted image forcefully

Enjoy the Day!

Add a Comment

Your email address will not be published. Required fields are marked *