最新下载
热门教程
- 1
 - 2
 - 3
 - 4
 - 5
 - 6
 - 7
 - 8
 - 9
 - 10
 
php 图形处理函数imagetype
时间:2022-06-24 21:44:45 编辑:袖梨 来源:一聚教程网
php教程 图形处理函数imagetypes() imagecreatetruecolor() imagecreate()
//判断当前的gd库是否支持png
if(imagetypes() & img_png)
{
echo "png support is enabled";
}
else
{
echo "png support is disabled";
}
/*
int imagetypes ( void )
本函数以比特字段方式返回与当前 php 版本关联的 gd 库所支持的图像格式。将返回以下结果,img_gif | img_jpg | img_png | img_wbmp| img_xpm。 例如要检查是否支持 png
*/
//创建图像
$img=imagecreatetruecolor(300,200);
//取得图像宽度
echo imagesx($img);
/*
看个实例
*///建立一幅 100x30 的图像
$im=imagecreate(100,30);
//白色背景和蓝色文本
$bg=imagecolorallocate($im,255,255,255);
$textcolor=imagecolorallocate($im,0,0,255);
//把字符串写在图像左上角
imagestring($im,5,0,0,"hello world!",$textcolor);
//输出图像
header("content-type: image/png");
imagepng($im);
/*
如果你想创建一个png图像*透明*,其中的背景是完全透明的,所有行动发生在借鉴,除此之外,然后执行下列操作:
*/
$png = imagecreatetruecolor(800, 600);
imagesavealpha($png, true);
$trans_colour = imagecolorallocatealpha($png, 0, 0, 0, 127);
imagefill($png, 0, 0, $trans_colour);
$red = imagecolorallocate($png, 255, 0, 0);
imagefilledellips教程教程e($png, 400, 300, 400, 300, $red);
header("content-type: image/png");
imagepng($png);
相关文章
- 鸣潮千咲技能详解 11-04
 - 燕云十六声探索有哪些技巧-探索技巧分享 11-04
 - 重返未来1999贝丽尔共鸣摆放推荐 11-04
 - 重返未来1999贝丽尔队伍搭配推荐 11-04
 - 重返未来1999贝丽尔塑造抽取建议 11-04
 - 逃离塔科夫兑换码怎么用 逃离塔科夫最新兑换码大全 11-04