Home > Article > Backend Development > Use PHP code to generate images on web pages, _PHP tutorial
The code is very simple, not much nonsense here,
<?php /** * Created by PhpStorm. * User: Administrator * Date: 2015/6/29 * Time: 21:25 */ header('Content-type:image/png');//设置mime type $img = imagecreate(400,300);//设置图片像素 imagecolorallocate($img,255,255,255);//给图片上色 imageellipse($img,200,200,50,50,imagecolorallocate($img,255,0,0));//在图片上绘制图形,中心点200,200;宽高50,50 imagepng($img);//设置图片格式为PNG
The effect is as follows:
The above is the entire content of this article, I hope you all like it.