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

imagepng returning 0 bytes image

P: 35
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....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);
  4.  
  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


YarrOfDoom
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.