desithugg Posted September 10, 2006 Share Posted September 10, 2006 Umm im trying to create a dynamic signature with php ive never done this before so i was looking for some examples i tried a couple like the one below and i keep getting the same error[quote]The image “http://pi.x3teamz.net/members/pic.php” cannot be displayed, because it contains errors.[/quote][code]<?php Header("Content-type: image/gif"); if(!isset($s)) $s=11; $text = "saad"; $size = imagettfbbox($s,0,"/fonts/TIMES.TTF",$text); $dx = abs($size[2]-$size[0]); $dy = abs($size[5]-$size[3]); $xpad=9; $ypad=9; $im = imagecreate($dx+$xpad,$dy+$ypad); $blue = ImageColorAllocate($im, 0x2c,0x6D,0xAF); $black = ImageColorAllocate($im, 0,0,0); $white = ImageColorAllocate($im, 255,255,255); ImageRectangle($im,0,0,$dx+$xpad-1,$dy+$ypad-1,$black); ImageRectangle($im,0,0,$dx+$xpad,$dy+$ypad,$white); ImageTTFText($im, $s, 0, (int)($xpad/2)+1, $dy+(int)($ypad/2), $black, "/fonts/TIMES.TTF", $text); ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2)-1, $white, "/fonts/TIMES.TTF", $text); ImageGif($im); ImageDestroy($im);?>[/code]yes i do have a fonts folder and a file called TIMES.TTF Quote Link to comment https://forums.phpfreaks.com/topic/20331-dynamic-image-generator/ Share on other sites More sharing options...
Barand Posted September 10, 2006 Share Posted September 10, 2006 Does it work if you specify absolute path to your font file instead of relative.The only error I found was with font file path - I had to substitute my own - but it worked OK then Quote Link to comment https://forums.phpfreaks.com/topic/20331-dynamic-image-generator/#findComment-89559 Share on other sites More sharing options...
desithugg Posted September 11, 2006 Author Share Posted September 11, 2006 umm nope doesnt work[code]<?php Header("Content-type: image/gif"); if(!isset($s)) $s=11; $text = "saad"; $size = imagettfbbox($s,0,"http://pi.x3teamz.net/fonts/TIMES.TTF",$text); $dx = abs($size[2]-$size[0]); $dy = abs($size[5]-$size[3]); $xpad=9; $ypad=9; $im = imagecreate($dx+$xpad,$dy+$ypad); $blue = ImageColorAllocate($im, 0x2c,0x6D,0xAF); $black = ImageColorAllocate($im, 0,0,0); $white = ImageColorAllocate($im, 255,255,255); ImageRectangle($im,0,0,$dx+$xpad-1,$dy+$ypad-1,$black); ImageRectangle($im,0,0,$dx+$xpad,$dy+$ypad,$white); ImageTTFText($im, $s, 0, (int)($xpad/2)+1, $dy+(int)($ypad/2), $black, "http://pi.x3teamz.net/fonts/TIMES.TTF", $text); ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2)-1, $white, "http://pi.x3teamz.net/fonts/TIMES.TTF", $text); ImageGif($im); ImageDestroy($im);?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/20331-dynamic-image-generator/#findComment-89560 Share on other sites More sharing options...
desithugg Posted September 11, 2006 Author Share Posted September 11, 2006 umm i think the problem is with my host i just tried some other host and it works Quote Link to comment https://forums.phpfreaks.com/topic/20331-dynamic-image-generator/#findComment-89561 Share on other sites More sharing options...
HuggieBear Posted September 11, 2006 Share Posted September 11, 2006 OK, check the version of PHP/GD you're using.GIF write support wasn't included as default in later versions, it was replaced by PNP, but some servers still have it.From the PHP Documentation:[color=red][i]Only supported in GD versions older than gd-1.6 and newer than gd-2.0.28. Read-only GIF support is available with PHP 4.3.0 and the bundled GD-library. Write support is avaliable since PHP 4.3.9 and PHP 5.0.1.[/i][/color]You can find this out my using phpinfo()RegardsRich Quote Link to comment https://forums.phpfreaks.com/topic/20331-dynamic-image-generator/#findComment-89563 Share on other sites More sharing options...
desithugg Posted September 11, 2006 Author Share Posted September 11, 2006 i tried png also Quote Link to comment https://forums.phpfreaks.com/topic/20331-dynamic-image-generator/#findComment-89567 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.