d22552000 Posted September 22, 2007 Share Posted September 22, 2007 I use the following code: (Custom Made so IDK if its proper commands) if($f[1]=='PNG' OR $f[1]=='png'){ $im=ImageCreateFromPNG("uploads/$name") or die('nocreate'); $width=ImageSx($im); $height=ImageSy($im); if ($width>$height) { $new_w = $n_width; $new_h = floor( $height * ( $new_w / $width ) ); } else { $new_h = $n_width; $new_w = floor( $width * ( $new_h / $height ) ); } $newimage=imagecreatetruecolor($new_w,$new_h); imageCopyResized($newimage,$im,0,0,0,0,$new_w,$new_h,$width,$height); ImagePNG($newimage,$tsrc) or die('nocreate2'); } It doesnt echo nocreate or nocreate2... But no thumbrail is created. Why doesn't it create it, any problems with my code or syntax? I have E_ALL in my error reporting at the first line of the file but no errors (or notices) are echoed. BTW, (EDIT) My filetypes returns (IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP | IMG_XPM), (everything) Quote Link to comment https://forums.phpfreaks.com/topic/70255-gd2-png-file-makelocalcopyresized-please-help/ Share on other sites More sharing options...
BlueSkyIS Posted September 22, 2007 Share Posted September 22, 2007 1. Are you sure processing is entering the if statement? (try an echo) 2. Where is $tsrc defined? Quote Link to comment https://forums.phpfreaks.com/topic/70255-gd2-png-file-makelocalcopyresized-please-help/#findComment-352849 Share on other sites More sharing options...
d22552000 Posted September 23, 2007 Author Share Posted September 23, 2007 1. Yes it enters the statement, it does do an echo I put in it. 2. TSRC is just a simple path in the computer. I don't think my commands are right, it wont create the PNG file in the thumbs folder th. It does everything else fine but wont export the file. I did the same thing for a jpg and gif and they both worked. but the png wont. Quote Link to comment https://forums.phpfreaks.com/topic/70255-gd2-png-file-makelocalcopyresized-please-help/#findComment-353287 Share on other sites More sharing options...
xyn Posted September 23, 2007 Share Posted September 23, 2007 see in order to create an image you NEED header("content type: image/png"); Quote Link to comment https://forums.phpfreaks.com/topic/70255-gd2-png-file-makelocalcopyresized-please-help/#findComment-353392 Share on other sites More sharing options...
BlueSkyIS Posted September 23, 2007 Share Posted September 23, 2007 I did the same thing for a jpg and gif and they both worked. but the png wont. ah. are you sure PNG support is compiled in? Check phpinfo(). Quote Link to comment https://forums.phpfreaks.com/topic/70255-gd2-png-file-makelocalcopyresized-please-help/#findComment-353415 Share on other sites More sharing options...
d22552000 Posted September 24, 2007 Author Share Posted September 24, 2007 1. header("content type: image/png"); WRONG< im saving to files NOT the browser... WRONG. 2. Yes png support is suppoorted , I put that in my main post. Quote Link to comment https://forums.phpfreaks.com/topic/70255-gd2-png-file-makelocalcopyresized-please-help/#findComment-353755 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.