GD for PHP

WBOY
Release: 2016-07-29 08:56:38
Original
1108 people have browsed it

gd image processing technology

extension=php_gd2.dll

Create canvas

Canvas, a resource type data, operable image resource

  • Create canvas (new)
    imageCreate(width,height) creates 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)

Operation canvas

Assign color: If you need to use a certain 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 image file
2. For direct output, you need to tell the browser to output image information (header("Content-type:image/png;"))
imagePNG(img[,url])
imageJPEG()
imageGIF()

Destroy 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(); ?>
Copy after login

GD for PHP

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above has introduced the GD of PHP, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!