Jump to content

PHP Image doesn't work


Recommended Posts

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:

$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);

$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");


And also the files: (.php in attachment)




Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.