PHP Create Image Verification code

Source: Internet
Author: User
Process:
1). Create an image resource, which will be based on this image resource in future operations.
$im =imagecreate (200,200)
2). Within the image resource, define a color (the 1th call, which is automatically populated as a background color).
Imagecolorallocate ($im, 0,102,255);
$white =imagecolorallocate ($im, 255,255,255);
3). Within an image resource, draw a graphic, or enter text.
(1) Coordinate system: the upper-left corner of the image resource is 0, 0 points
(2) All of the following coordinates, refers to: this coordinate system, the upper-left corner of a position coordinates
(2) Line: Imageline ($im, 0, 0, $, a, $white);
(3) Line: Imageline ($im, 0, 0, $, $white);
(3) Characters: Imagestring ($im, 5, N, Mr.Lee, $white);
4). Output the final graphic. Can be output directly, or generate files
If direct output, need to use header (), tell the browser, the current output of the picture type
Header (' content-type:image/png ');
Imagepng ($im);
5). Clear All Resources
Imagedestroy ($im);

The above describes the PHP create image verification code, including the aspects of the content, I hope the PHP tutorial interested in a friend helpful.

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