Php draws a straight line, and php draws a line. Php draws a straight line. This article describes how php draws a straight line. Share it with you for your reference. The specific implementation method is as follows: Copy the code php to draw a straight line, and php to draw a method
This example describes how to draw a straight line in php. Share it with you for your reference. The specific implementation method is as follows:
The code is as follows:
<? Php
// 1. create a canvas
$ Im = imagecreatetruecolor (300,200); // create a real-color image. the default background is black and the image identifier is returned. Another function, imagecreate, is not recommended.
// 2. draw the desired image
$ Red = imagecolorallocate ($ im, 255, 0, 0); // create a color for use
Imageline ($ im, 30, 30, 240,140, $ red); // draw a straight line. Parameter description: 30, 30 indicates the start coordinate; 240,140 indicates the end coordinate
// 3. output image
Header ("content-type: image/png ");
Imagepng ($ im); // output to the page. If the second parameter [, $ filename] exists, the image is saved.
// 4. destroy images and release memory
Imagedestroy ($ im );
?>
I hope this article will help you with php programming.
Examples in this article describes how php draws a straight line. Share it with you for your reference. The specific implementation method is as follows :...