This post can help you convert a PNG to a JPG and GIF.
Create a file image_converter.php.
This code shows all three parameters of the convert_image() function:
$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.
$image_quality => can be adjusted if you don’t want 100% quality.
Create index.php to Upload the image.
Create convert.php to convert the image. And make a folder in your directory name as uploads. Because when the image is uploaded or convert, the image will save on this folder.
Create a download.php to downloads the converted image forcefully.
Then, Run the index.php and see the view.
After uploading the image.
After converting the image.
Then, you can download or convert another image.