最新下载
热门教程
- 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);
相关文章
- 人渣SCUM简易背包怎么制作 简易背包制作方法分享 07-31
- 现货黄金突破3400美元创日内新高 07-31
- "Crypto Fixes This": 币安CEO发表重要声明 07-31
- 龙魂旅人爱神维纳斯阵容搭配攻略 07-31
- 永远的蔚蓝星球76-80关通关攻略 07-31
- 王者荣耀奕星怎么玩 07-31