PHP's GD

Source: Internet
Author: User

GD Image Processing Technology

Extension=php_gd2.dll

Create a canvas

Canvas, a resource-based data, an actionable image resource

    • Create canvas (New)
      Imagecreate (width,height) Creating a palette-based canvas
      Imagecreatetruecolor (width,height) Create a true color canvas
    • Create a canvas based on a picture (open)
      Imagecreatefromjpeg (URL)
      Imagecreatefrompng (URL)
      Imagecreatefromgif (URL)

Manipulating the canvas

Assign color: If you need to use a color on the canvas, you should assign the color to the canvas first.
(color identification) = Imagecolorallocate (img,r,g,b)

Fill Canvas

Imagefill (img,x,y, color identification)

Output canvas

1, output to picture file
2, direct output, need to tell the browser output as Picture information (header ("content-type:image/png;") )
Imagepng (Img[,url])
Imagejpeg ()
Imagegif ()

Destroying Canvas Resources

Imagedestroy (IMG)


    
     header('content-type:image/png');$img = imagecreate(300,300);$color = imagecolorallocate($img,223,22,44);imagefill($img,3,3,$color);imagepng($img);imagedestroy();?>

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above describes the PHP gd, including aspects of the content, I hope that 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.