I made a function to handle jpg and png files, but i get error when trying to upload a png file.
this is the function:
function createImg ($type, $src, $
The problem is because imagejpeg quality can be up to 100, whereas imagepng maximum quality is 9. try this
imagejpeg
imagepng
else if ($type == "png") { //imagepng() creates a PNG file from the given image. $q=9/100; $quality*=$q; imagepng($newImage,$dst,$quality); }