玩转图像函数库—常见图形操作
我尽量不说大理论,诸如什么是png,自己查解决. PHP自4.3版本开始,捆绑了自己的GD2库,用户可以自己下载并设置.如果要查看自己的php版本是否支持gd模块(支持JPEG,PNG,WBMP但不再支持GIF),如下方式是一种方法: if(!function_exists('imagecreate')) { 如果不支持的话,如何配置 ? 下载gd模块的dll文件,修改php.ini,重启服务器即可. 以下简称PHP作图为PS. 当您打算 PS的话,应该完成如下如下步骤,这是必经的. 1:创建基本PS对象(我假设为$image),填充背景(默认黑),以后的全部ps操作都是基于这个背景图像的. 首先,我们来认识几个常用的函数,这些函数在php手册里面都有详细介绍,此处大体引用下. resource imagecreate ( int x_size, int y_size ) int imagecolorallocate ( resource image, int red, int green, int blue ) bool imagefill ( resource image, int x, int y, int color )
bool imagestring ( resource image, int font, int x, int y, string s, int col ) array imagettftext ( resource image, float size, float angle, int x, int y, int color, string fontfile, string text ) bool imagefilltoborder ( resource image, int x, int y, int border, int color ) bool imagefilledellipse ( resource image, int cx, int cy, int w, int h, int color ) 输出图像数据:imagepng($image[,$filename]) (编辑:焦作站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |