imagepng returning 0 bytes image

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ukfusion
    New Member
    • Sep 2007
    • 35

    imagepng returning 0 bytes image

    Hi,

    I've got a php image upload/resize script working...its working fine for jpegs, gifs(both transparent and not) but pngs's just wont work....it all uploads fine...creates the thumbnail....bu t when you view it its 0bytes...the original file uploads fine...its just after trying to resize.

    Theres no errors in the log file.

    Heres the relevent parts of the script...all the variables used in the script are already set....the transparency function is for the gifs...dont know if its needed for the pngs too...i've tried with and without it applied but still no luck.


    Code:
    $tn = imagecreatetruecolor($modwidth, $modheight);
    $image = imagecreatefrompng($file);
    $this->setTransparency($tn,$image);
    
    imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height); 
    imagepng($tn, $save, 100);
  • YarrOfDoom
    Recognized Expert Top Contributor
    • Aug 2007
    • 1243

    #2
    As described in the documentation, the quality parameter only goes from 0 to 9 for png images.

    Comment

    Working...