Php image processing function imagetype_PHP tutorial

Source: Internet
Author: User
Php image processing function imagetype. Php Tutorial image processing function imagetypes () imagecreatetruecolor () imagecreate () determine whether the current gd library supports pngif (imagetypes () img_png) {echopngsuppsuppisenabled ;} else {php Tutorial graphic processing function imagetypes () imagecreatetruecolor () imagecreate ()
// Determine whether 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 in the form of bits. The following result is returned: img_gif | img_jpg | img_png | img_wbmp | img_xpm. For example, to check whether png is supported

*/

// Create an image
$ Img = imagecreatetruecolor (0, 300,200 );
// Obtain the image width
Echo imagesx ($ img );


/*
View instances
*/

// Create an image of 100x30
$ Im = imagecreate (100,30 );
// White background and blue text
$ Bg = imagecolorallocate ($ im, 255,255,255 );
$ Textcolor = imagecolorallocate ($ im, 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 *, the background is completely transparent, and all actions are taken for reference, perform the following operations:
*/

$ 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, 400,300,400,300, $ red );

Header ("content-type: image/png ");
Imagepng ($ png );

Imagetypes () imagecreatetruecolor () imagecreate () // determines whether 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.