Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

integer imagecolorallocate(integer image, integer red, integer
green, integer blue)


The imagecolorallocate function allocates a color in the given image. The color is
specified by the amount of red, green, and blue. An identifier is returned for referring to
this color in other functions.


<?
/*
* Draw Red, Green, Blue circles
/


//create white square
$image = imagecreate(200,200);
$colorWhite = imagecolorallocate($image, 255,255,255);
$colorRed = imagecolorallocate($image, 255, 0, 0);
$colorGreen = imagecolorallocate($image, 0, 255, 0);
$colorBlue = imagecolorallocate($image, 0, 0, 255);
imagefill($image, 0, 0, $colorWhite);

Free download pdf