FalcoG Posted March 28, 2012 Share Posted March 28, 2012 I just started with php and made an image. But when I try to open it in my browser, it shows a broken image icon. I have put the font in the same folder as the .php file, but it doesn't work. Can somebody help me solve this problem? Here is the code: <?php $font_path = "nakedchick.TTF"; $font_size = 30; $img_number = imagecreate(300,50); $backcolor = imagecolorallocate($img_number,0,162,255); $textcolor = imagecolorallocate($img_number,255,255,255); imagefill($img_number,0,0,$backcolor); $number = " So your ip is $_SERVER[REMOTE_ADDR]? "; ImageTTFText($img_number, $font_size,10,5,5,$number,$font_path,$textcolor); header("Content-type: image/png"); imagepng($img_number); ?> And also the files: (.php in attachment) http://falcogerritsjans.nl/u/signature2.php http://falcogerritsjans.nl/u/nakedchick.ttf 17912_.php Link to comment https://forums.phpfreaks.com/topic/259904-php-image-doesnt-work/ Share on other sites More sharing options...
darkfreaks Posted March 29, 2012 Share Posted March 29, 2012 try using lowercase there is no function in uppercase replace imageTTFtext with imagettftext Link to comment https://forums.phpfreaks.com/topic/259904-php-image-doesnt-work/#findComment-1332197 Share on other sites More sharing options...
BK87 Posted March 29, 2012 Share Posted March 29, 2012 your imagettftext function format is invalid, refer to manual. http://us.php.net/manual/en/function.imagettftext.php replace your code with this line ImageTTFText($img_number, $font_size,10,5,5,$textcolor,$font_path,$number); Link to comment https://forums.phpfreaks.com/topic/259904-php-image-doesnt-work/#findComment-1332219 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.