PHP image Processing Simple example _php tutorial

Source: Internet
Author: User
Tags image identifier
Imagecreatetruecolor () returns an image identifier representing the black image of the specified size.

According to your PHP tutorial and the GD version of the function definition or not. For PHP 4.0.6 through 4.1.x This function always exists


*/
$im =imagecreatetruecolor (100,100); Create an image
$string = ' n '; Defining characters
$white =imagecolorallocate ($im, 255,255,255); Define White
$black =imagecolorallocate ($im, 0,0,0); Define Black
$red =imagecolorallocate ($im, 255,0,0); Define Red
Output a black "Z" on a white background, actually upside down n
Imagecharup ($im, 6,20,20, $string, $white);
Imagechar ($im, 2,40,40, "R", $red); Use red to draw a character
Header (' content-type:image/png '); Output header information
Imagepng ($im); Output PNG file
Imagedestroy ($im); Destroying images

//

$img =imagecreatetruecolor (400,400); Create an image
$white =imagecolorallocate ($img, 255,255,255); Define White
$black =imagecolorallocate ($img, 0,0,0); Define 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); Destroying images

//
$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,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 an alpha value
$yellow =imagecolorallocatealpha ($image, 255,255,0,75);
$red =imagecolorallocatealpha ($image, 255,0,0,75);
$blue =imagecolorallocatealpha ($image, 0,0,255,75);
Draw a circle of three overlapping
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 file header
Header (' content-type:image/png ');
Final output results
Imagepng ($image);
Imagedestroy ($image);

//

$im =imagecreate (100,100); Create an image
$string = ' php '; Defining strings
$BG =imagecolorallocate ($im, 255,255,255); Define White
$black =imagecolorallocate ($im, 0,0,0); Define Black
Outputs 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); Destroying images

?>

http://www.bkjia.com/PHPjc/632992.html www.bkjia.com true http://www.bkjia.com/PHPjc/632992.html techarticle Imagecreatetruecolor () returns an image identifier representing the black image of the specified size. According to your PHP tutorial and the GD version of the function definition or not. For PHP 4.0.6 through 4.1.x this function ...

  • 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.