creating png files

后端 未结 3 1866
醉话见心
醉话见心 2021-02-15 00:44

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, $         


        
3条回答
  •  忘掉有多难
    2021-02-15 01:22

    The problem is because imagejpeg quality can be up to 100, whereas imagepng maximum quality is 9. try this

     else if ($type == "png") {
    //imagepng() creates a PNG file from the given image. 
    $q=9/100;
    $quality*=$q;
    imagepng($newImage,$dst,$quality);      
    }
    

提交回复
热议问题