Php image processing simple example _ PHP Tutorial

Source: Internet
Author: User
Tags image identifier
Simple php image processing example. Imagecreatetruecolor () returns an image identifier representing a black image of the specified size. According to your php Tutorial and function definition in the gd version. For php4.0.6, the imagecreatetruecolor () function imagecreatetruecolor () returns an image identifier representing the specified size of the black image.

According to your php Tutorial and function definition in the gd version. For php 4.0.6, the function 4.1.x always exists.

,
*/
$ Im = imagecreatetruecolor (100,100); // create an image
$ String = 'n'; // defines the character
$ White = imagecolorallocate ($ im, 255,255,255); // defines white
$ Black = imagecolorallocate ($ im, 0); // defines the black
$ Red = imagecolorallocate ($ im, 255, 0, 0); // defines the red color.
// Output a black "z" on the white background, which is actually inverted n
Imagecharup ($ im, 6,20, 20, $ string, $ white );
Imagechar ($ im, 40, "r", $ red); // draw characters in red
Header ('content-type: image/png '); // output header information
Imagepng ($ im); // output png file
Imagedestroy ($ im); // destroy the image

//

$ Img = imagecreatetruecolor (400,400); // create an image
$ White = imagecolorallocate ($ img, 255,255,255); // defines white
$ Black = imagecolorallocate ($ img, 0); // defines the 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 as png image
Imagedestroy ($ img); // destroy the image

//
$ Size = 300;
$ Image = imagecreatetruecolor ($ size, $ size );
// Draw a box with a white background and a black border
$ Back = imagecolorallocate ($ image, 255,255,255 );
$ Border = imagecolorallocate ($ image, 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 colors with the alpha value
$ Yellow = imagecolorallocatealpha ($ image, 255,255 );
$ Red = imagecolorallocatealpha ($ image, 0 );
$ Blue = imagecolorallocatealpha ($ image );
// 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
Header ('content-type: image/png ');
// Final output result
Imagepng ($ image );
Imagedestroy ($ image );

//

$ Im = imagecreate (100,100); // create an image
$ String = 'php'; // define a string
$ Bg = imagecolorallocate ($ im, 255,255,255); // defines White
$ Black = imagecolorallocate ($ im, 0); // defines the 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

?>

The http://www.bkjia.com/PHPjc/632992.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/632992.htmlTechArticleimagecreatetruecolor () returns an image identifier representing a black image of the specified size. According to your php Tutorial and function definition in the gd version. For php 4.0.6, use the function 4.1.x...

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.