By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,054 Members | 1,322 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,054 IT Pros & Developers. It's quick & easy.

imagepng returning 0 bytes image

P: 35

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 all uploads fine...creates the thumbnail....but 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.

Expand|Select|Wrap|Line Numbers
  1. $tn = imagecreatetruecolor($modwidth, $modheight);
  2. $image = imagecreatefrompng($file);
  3. $this->setTransparency($tn,$image);
  5. imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height); 
  6. imagepng($tn, $save, 100); 
Feb 2 '12 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 1,247
As described in the documentation, the quality parameter only goes from 0 to 9 for png images.
Feb 16 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.