用PHP代码在网页上生成图片
1 <?
php
2 /**
3 * Created by PhpStorm.
4 * User: Administrator
5 * Date: 2015/6/29
6 * Time: 21:25
7 */
8 header('Content-type:image/png');
//设置mime type
9 $img = imagecreate(400,300);
//设置图片像素
10 imagecolorallocate(
$img,255,255,255);
//给图片上色
11 imageellipse(
$img,200,200,50,50,imagecolorallocate(
$img,255,0,0));
//在图片上绘制图形,中心点200,200;宽高50,50
12 imagepng(
$img);
//设置图片格式为PNG
效果如下:
转载于:https://www.cnblogs.com/Vito-L/p/4608970.html