PHP Tutorial Graphics processing function imagetypes () Imagecreatetruecolor () imagecreate ()
Determine if the current GD library supports PNG
if (Imagetypes () & Img_png)
{
echo "PNG support is enabled";
}
Else
{
echo "PNG support is disabled";
}
/*
int imagetypes (void)
This function returns the image formats supported by the GD library associated with the current PHP version as a bit field. The following results will be returned, Img_gif | img_jpg | Img_png | img_wbmp| img_xpm. For example, to check whether PNG is supported
*/
Create an image
$img =imagecreatetruecolor (300,200);
Get Image width
echo Imagesx ($img);
/*
See an example
*/
Create a picture of a 100x30
$im =imagecreate (100,30);
White background and blue text
$BG =imagecolorallocate ($im, 255,255,255);
$textcolor =imagecolorallocate ($im, 0,0,255);
Write the string in the upper left corner of the image
Imagestring ($im, 5,0,0, "Hello world!", $textcolor);
Output image
Header ("Content-type:image/png");
Imagepng ($im);
/*
If you want to create a PNG image * transparent *, where the background is completely transparent, all actions take place in addition to, and then do the following:
*/
$png = Imagecreatetruecolor (800, 600);
Imagesavealpha ($png, true);
$trans _colour = Imagecolorallocatealpha ($png, 0, 0, 0, 127);
Imagefill ($png, 0, 0, $trans _colour);
$red = Imagecolorallocate ($png, 255, 0, 0);
Imagefilledellips Tutorial E ($png, D, D, F, $red);
Header ("Content-type:image/png");
Imagepng ($png);
http://www.bkjia.com/PHPjc/631351.html www.bkjia.com true http://www.bkjia.com/PHPjc/631351.html techarticle PHP Tutorial Graphics processing function imagetypes () Imagecreatetruecolor () imagecreate ()//Determine if the current GD library supports PNG if (imagetypes () img_png) {echo png Support is enabled; } else {...