php生成gif动态图片验证码

php生成gif动态图片验证码

ID:8791524

大小:47.00 KB

页数:5页

时间:2018-04-07

php生成gif动态图片验证码_第1页
php生成gif动态图片验证码_第2页
php生成gif动态图片验证码_第3页
php生成gif动态图片验证码_第4页
php生成gif动态图片验证码_第5页
资源描述:

《php生成gif动态图片验证码》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库

1、文章支持:肾病饮食网www.shenbingyinshi.comPHP生成GIF动态图片验证码相信很多人都想过如何用PHP生成GIF动画来实现动态图片验证码,以下是实现过程。mageCode函数通过GIFEncoder类实现的GIF动画的PHP源代码,有兴趣的朋友可以研究一下。效果如图:/**  *Image...     相信很多人都想过如何用PHP生成GIF动画来实现动态图片验证码,以下是实现过程。  ImageCode函数通过GIFEncoder类实现的GIF动画的PHP源代码,有兴趣的朋友可以研究一下。  效果如图:   /*

2、*  *ImageCode生成GIF图片验证  *@param$string字符串  *@param$width宽度  *@param$height高度  **/  functionImageCode($string='',$width=75,$height=25)  {  $authstr=$string?$string:((time()%2==0)?mt_rand(1000,9999):mt_rand(10000,99999));  $board_width=$width;  $board_height=$height;  //生

3、成一个32帧的GIF动画  for($i=0;$i<32;$i++)  {  ob_start();  $image=imagecreate($board_width,$board_height);  imagecolorallocate($image,0,0,0);  //设定文字颜色数组  $colorList[]=ImageColorAllocate($image,15,73,210);  $colorList[]=ImageColorAllocate($image,0,64,0);  $colorList[]=ImageCol

4、orAllocate($image,0,0,64);  $colorList[]=ImageColorAllocate($image,0,128,128);  $colorList[]=ImageColorAllocate($image,27,52,47);  $colorList[]=ImageColorAllocate($image,51,0,102);  $colorList[]=ImageColorAllocate($image,0,0,145);  $colorList[]=ImageColorAllocate($image

5、,0,0,113);  $colorList[]=ImageColorAllocate($image,0,51,51);  $colorList[]=ImageColorAllocate($image,158,180,35);  $colorList[]=ImageColorAllocate($image,59,59,59);  $colorList[]=ImageColorAllocate($image,0,0,0);  $colorList[]=ImageColorAllocate($image,1,128,180);  $col

6、orList[]=ImageColorAllocate($image,0,153,51);  $colorList[]=ImageColorAllocate($image,60,131,1);  $colorList[]=ImageColorAllocate($image,0,0,0);  $fontcolor=ImageColorAllocate($image,0,0,0);  $gray=ImageColorAllocate($image,245,245,245);  $color=imagecolorallocate($imag

7、e,255,255,255);  $color2=imagecolorallocate($image,255,0,0);  imagefill($image,0,0,$gray);  $space=15;//字符间距  if($i>0)//屏蔽第一帧  {  for($k=0;$k

8、ring($image,6,$space*$k,$top+$float_top,substr($authstr,$k,1),$colorList[$colorRandom]);  }  }  for($k=0;$k<20

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。