Home >Backend Development >PHP Tutorial >Use PHP code to generate images on web pages_PHP tutorial
This article mainly introduces the methods and examples of using PHP code to generate images on web pages. It is very simple and practical. If necessary, Friends can refer to it.
The code is very simple, no more nonsense here,
?
2 4 56 |
/** * Created by PhpStorm. * User: Administrator * Date: 2015/6/29 * Time: 21:25 */ header('Content-type:image/png');//Set mime type $img = imagecreate(400,300);//Set image pixels imagecolorallocate($img,255,255,255);//Color the picture imageellipse($img,200,200,50,50,imagecolorallocate($img,255,0,0));//Draw graphics on the picture, center point 200,200; width and height 50,50 imagepng($img);//Set the image format to PNG |