imagecreatetruecolor() returns an image identifier representing a black image of the specified size.
According to your php tutorial and gd version whether the function is defined or not. For php 4.0.6 through 4.1.x this function always exists
,
*/
$im=imagecreatetruecolor(100,100); //Create image
$string='n'; //Define character
$white=imagecolorallocate($im,255,255,255); //Define white
$black=imagecolorallocate($im,0,0,0); //Define black
$red=imagecolorallocate($im,255,0,0); //Define red
//Output a black "z" on a white background, which is actually an upside-down n
imagecharup($im,6,20,20,$string,$white);
imagechar($im,2,40,40,"r",$red); //Use red to draw the character
header('content-type: image/png'); //Output header information
imagepng($im); //Output png file
imagedestroy($im); //Destroy the image
//
$img=imagecreatetruecolor(400,400); //Create image
$white=imagecolorallocate($img,255,255,255); //Define white
$black=imagecolorallocate($img,0,0,0); //Define black
imagearc($img,200,200,350,350,0,360,$white); //Draw an elliptical arc
header("content-type: image/png"); //Output header information
imagepng($img); //Output is png image
imagedestroy($img); //Destroy the image
//
$size=300;
$image=imagecreatetruecolor($size,$size);
//Draw a square with a white background and a black border
$back=imagecolorallocate($image,255,255,255);
$border=imagecolorallocate($image,0,0,0);
imagefilledrectangle($image,0,0,$size-1,$size-1,$back);
imagerectangle($image,0,0,$size-1,$size-1,$border);
$yellow_x=100;
$yellow_y=75;
$red_x=120;
$red_y=165;
$blue_x=187;
$blue_y=125;
$radius=150;
//Assign some color with alpha value
$yellow=imagecolorallocatealpha($image,255,255,0,75);
$red=imagecolorallocatealpha($image,255,0,0,75);
$blue=imagecolorallocatealpha($image,0,0,255,75);
//Draw three overlapping circles
imagefilledellips tutorial e($image,$yellow_x,$yellow_y,$radius,$radius,$yellow);
imagefilledellipse($image,$red_x,$red_y,$radius,$radius,$red);
imagefilledellipse($image,$blue_x,$blue_y,$radius,$radius,$blue);
//Output header file header
header('content-type: image/png');
//Final output result
imagepng($image);
imagedestroy($image);
//
$im=imagecreate(100,100); //Create image
$string='php'; //Define string
$bg=imagecolorallocate($im,255,255,255); //Define white
$black=imagecolorallocate($im,0,0,0); //Define black
//Output the specified character
in the upper left corner
imagechar($im,1,0,0,$string,$black);
header('content-type: image/png'); //Output header information
imagepng($im); //Output png file
imagedestroy($im); //Destroy the image
?>