PHP Graphics processing Function imagetype_php Tutorial

Source: Internet
Author: User
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 {...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.