Home >Backend Development >PHP Tutorial >PHP drawing examples, drawing examples_PHP tutorial
The example in this article describes how to draw pictures in PHP. Share it with everyone for your reference. The specific implementation method is as follows:
The running effect of this example is shown in the figure below
For more information, please refer to:
http://www.php.net/manual/zh/refs.utilspec.image.php
I hope this article will be helpful to everyone’s PHP programming design.
Put the header first and try again. If not, please report a bug.
header("Content-Type:image/gif");
$img=imagecreatetruecolor(50,50);
1) First check that your PHP does not support the GD library. If it is a windows system,
just remove the semicolon in front of extension=php_gd2.dll in php.ini.
If it is a Linux system, please check the PHP reference manual for the installation instructions of the GD library
2) The code example is as follows:
// Create a 520* 300 picture,
$im = imagecreatetruecolor(520, 300);
imagefilledrectangle($im, 0, 0, 520, 300, 0xFFFFFF);
imageline($im,10,270,510,270,0x000000);
......
// Save the image to file and free memory
imagepng($im, 'photo_stamp.png');
imagedestroy($im);
?>
3) Just draw other systems in sequence.