willpower Posted October 25, 2007 Share Posted October 25, 2007 Hi. I had a dynamic img creation with gdlib and Right Alignment. I 'pinched' this script which worked well until my host upgraded to php5. Any ideas. the following error messages are received. ‰PNG IHDR2ý~Ê Warning: imagepng() [function.imagepng]: gd-png: fatal libpng error: zlib error in /home/clearcon/public_html/fonts/title.php on line 40 Warning: imagepng() [function.imagepng]: gd-png error: setjmp returns error condition in /home/clearcon/public_html/fonts/title.php on line 40 Heres the code <?php header("Content-type: image/png"); $text = str_replace("_"," ",$_GET['title']); $font = "DAX-REGU.TTF"; $size = 22; $angle = 0; //check width of the text $bbox = imagettfbbox ($size, $angle, $font, $text); $bbox["left"] = 0- min($bbox[0],$bbox[2],$bbox[4],$bbox[6]); $bbox["top"] = 0- min($bbox[1],$bbox[3],$bbox[5],$bbox[7]); $bbox["width"] = max($bbox[0],$bbox[2],$bbox[4],$bbox[6]) - min($bbox[0],$bbox[2],$bbox[4],$bbox[6]); $bbox["height"] = max($bbox[1],$bbox[3],$bbox[5],$bbox[7]) - min($bbox[1],$bbox[3],$bbox[5],$bbox[7]); extract ($bbox, EXTR_PREFIX_ALL, 'bb'); //check width of the image $insert = imagecreatetruecolor(400,50); //choose textcolor (white) $width = imagesx($insert); $height = imagesy($insert); $pad = 2; $white=imagecolorallocate($insert,255,255,255); $col=imagecolorallocate($insert,55,27,66); imagefilltoborder ( $insert, 0, 0, $white,$white ); //write text // top: //imagettftext($insert, $size, $angle, $width/2-$bb_width/2, $bb_top+$pad, $col, $font, $text); // left: //imagettftext($insert, $size, $angle, $bb_left+$pad, $height/2-$bb_height/2, $col, $font, $text); // bottom: //imagettftext($insert, $size, $angle, $width/2-$bb_width/2, $height-$bb_height-$pad, $col, $font, $text); // right: imagettftext($insert, $size, $angle, $width-$bb_width-$pad, 22, $col, $font, $text); //output picture imagepng($insert,"",100); imagedestroy($insert); exit; ?> Quote Link to comment https://forums.phpfreaks.com/topic/74816-changed-to-php5-now-script-doesnt-work/ Share on other sites More sharing options...
btherl Posted October 26, 2007 Share Posted October 26, 2007 My gut feeling is that it's a problem with your hosting provider's libraries. I recommend sending the error to them. Then again, I know very little about the GD libraries .. I'm sure someone else is better placed to advise. You might also want to try changing the "" in the imagepng() call to null, as that is what is specified in the documentation for imagepng(): imagepng($insert, null, 100); Quote Link to comment https://forums.phpfreaks.com/topic/74816-changed-to-php5-now-script-doesnt-work/#findComment-378301 Share on other sites More sharing options...
tippy_102 Posted October 26, 2007 Share Posted October 26, 2007 I tried your posted script using PHP Version 5.0.5 and it worked fine, without error. Quote Link to comment https://forums.phpfreaks.com/topic/74816-changed-to-php5-now-script-doesnt-work/#findComment-378370 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.