【php开源代码栏目提醒】:网学会员鉴于大家对php开源代码十分关注,论文会员在此为大家搜集整理了“imageshape.php”一文,供大家参考学习
<?php
// 建立多边型顶点坐标数组
$values = array(
0 =>40, // x1
1 => 50, // y1
2 => 20, // x2
3 => 140, // y2
4 => 60, // x3
5 => 60, // y3
6 => 140, // x4
7 => 20, // y4
8 => 50, // x5
9 => 40, // y5
10 => 15, // x6
11 => 30, // y6
);
// 创建图像
$im = imagecreate(250, 150);
// 设置颜色
$bg = imagecolorallocate($im, 155, 215, 215);
$blue = imagecolorallocate($im, 232, 122, 255);
// 画一个多边型
imagefilledpolygon($im, $values,6, $blue );
// 输出图像
header('Content-type: image/png');
imagepng($im);
//释放资源
imagedestroy($im);
?>