燕十八ajax笔记,燕十八商城笔记资料.doc

第168课: 文件上传参数细节

如果上传出错了,错误代码可能有哪些????其值为?1,上传的文件超过了?php.ini?中?upload_max_filesize?选项限制的值。??其值为?2,上传文件的大小超过了?HTML?表单中?MAX_FILE_SIZE?选项指定的值。??其值为?3,文件只有部分被上传。??其值为?4,没有文件被上传。??其值为?6,找不到临时文件夹。PHP?4.3.10?和?PHP?5.0.3?引进。??其值为?7,文件写入失败。PHP?5.1.0?引进。?

第172课: GD安装及画图流程

GD库画图的典型流程!?1:创建画布?2:创建各种颜料?3:绘画(如写字,画线,画矩形等形状)?4:保存成图片?5:清理战场,销毁画布!?

/*?1:造画布(多宽,多高)??imagecreatetruecolor() // 新建一个真彩色图像image create true color

? ? ? ? ? ? ? ? ? ?imagecreate//新建一个基于调色板的图像image create??返回是资源类型?*/?$width?=?300;?$height?=?200;?$im?=?imagecreatetruecolor($width,$height);?$im?=?imagecreate($width,$height);??/*?2:创建颜料?imagecolorallocate?//image color allocateimagecolorallocate(画布资源,红,绿,蓝)?*/?$blue?=?imagecolorallocate($im,0,0,255);?/*?3:画图?先用最简单的,泼墨渲染!?imagefill?imagefill是用颜料填充画布?bool?imagefill?(画布资源?,?填充的起始点x值?,?填充的起始点y值?,?填充颜色)?*/?imagefill($im,0,0,$blue); //image fill?/*?4:保存!?imagepng?imagejpeg?imagegif?..?来保存成不同图片格式?*/?if(imagepng($im,'./01.png'))?{?????echo?'图片生成成功!';?}?else?{?????echo?'fail';?}?/*?5:销毁画布?画布很耗资源,注意释放!?*/?imagedestroy($im); //image destroy

第173课: GD画图流程详解

function LoadGif ( $imgname )

{

? ? ?/* 尝试打开 */

? ? ?$im = @ imagecreatefromgif ( $imgname );

? ? ?/* 判断是否打开失败 */

? ? ?if(! $im )

? ? {

? ? ? ? ?/* 创建一个空白画布 */

? ????im = imagecreatetruecolor ( 150 , 30 );

?????bgc = imagecolorallocate ( $im , 255 , 255 , 255 );

?????tc = i magecolorallocate ( $im , 0 , 0 , 0 );

??* image filled rectangle */

????爄magefilledrectangle ( $im , 0 , 0 , 150 , 30 , $bgc );

?????* 输出错误信息 */

? ? ? ? ?imagestring ( $im , 1 , 5 , 5 , 'Error loading ' . $imgname , $tc );

? ? }

? ? return $im ;

}

$img = LoadGif ( 'im01.gif' );

imagegif ( $img );

imagedestroy ( $img );

在验证码里,这个功能必用.?生成文字干扰线

bool?imageline?( resource?$image?, int?$x1?, int?$y1?, int?$x2?, int?$y2?, int?$color?)

第174课: GD完成验证码

bool?imagestring?(?resource?$image?,?int?$font?,?int?$x?,?int?$y?,?string?$s?,?int?$col?)?参数分别代表:?画布资源,字体大小(1-5中选择),

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值