Using GD2 Library to create graphics in PHP does not show up in the browser
I just learned PHP soon, when using the GD2 library to create images in the browser to display the image, only a logo representing the image, my code is as follows:
Header ("Content-type:image/gif");
$image = Imagecreate (300,80);
$BG = Imagecolorallocate ($image, 220, 40, 120);
Imagegif ($image);
?>
Should be no problem, but it is not shown, you are the Master of the guide Ah! Thank you!
------Solution--------------------
Your program files are utf-8, right?
Please remove BOM header
------Solution--------------------
This post was last edited by xuzuning on 2012-07-24 09:04:58
Save-Time Select GBK encoding
------Solution--------------------
Open the PHP error prompt. Comment out the header to see what error is being prompted.
In php.ini
Display_errors=on
Error_reporting=e_all & ~notice
Restart Apache
------Solution--------------------
Let's say your program is named pict.php.
Then create a new program with the following content:
Coho Base64_encode (file_get_contents (' http://localhost/pict.php '));
Post the results after running