After imagecreatetruecolor() creates a true color image,
It will not automatically use the first color registered by the imagecolorallocate() method as the background color, but must be filled with imagefill()
//Set color
$bg = imagecolorallocate($im, 240, 240, 0);//Set the background color
imagefill($im,0,0,$bg);//Load background color
$te = imagecolorallocate($im, 0, 0, 0);//String color
//Add string to image
imagestring($im,rand(3,6),rand(5,60),rand(5,15),$rand,$te);
//Output picture
header("Content-type: image/jpeg");
imagejpeg($im);imagecreatetruecolor() returns an image identifier representing a black image of the specified size.
Depending on whether the function is defined or not in your PHP and GD versions. For PHP 4.0.6 through 4.1.x this function is always present
For more details, please check: php tutorialer/24/php-imagecreatetruecolor.htm">http://www.bKjia.c0m/phper/24/php-imagecreatetruecolor.htm