资源预览内容
第1页 / 共5页
第2页 / 共5页
第3页 / 共5页
第4页 / 共5页
第5页 / 共5页
亲,该文档总共5页全部预览完了,如果喜欢就下载吧!
资源描述
文章支持:肾病饮食网www.shenbingyinshi.comPHP生成GIF动态图片验证码相信很多人都想过如何用PHP生成GIF动画来实现动态图片验证码,以下是实现过程。mageCode函数通过GIFEncoder类实现的GIF动画的PHP源代码,有兴趣的朋友可以研究一下。效果如图: /* Image. 相信很多人都想过如何用PHP生成GIF动画来实现动态图片验证码,以下是实现过程。ImageCode函数通过GIFEncoder类实现的GIF动画的PHP源代码,有兴趣的朋友可以研究一下。效果如图:/* ImageCode 生成GIF图片验证* param $string 字符串* param $width 宽度* param $height 高度* */function ImageCode($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;/ 生成一个32帧的GIF动画for($i = 0; $i 0) / 屏蔽第一帧for ($k = 0; $k strlen($authstr); $k+)$colorRandom = mt_rand(0,sizeof($colorList)-1);$float_top = rand(0,4);$float_left = rand(0,3);imagestring($image, 6, $space * $k, $top + $float_top, substr($authstr, $k, 1), $colorList$colorRandom);for ($k = 0; $k 20; $k+)$colorRandom = mt_rand(0,sizeof($colorList)-1);imagesetpixel($image, rand()%70 , rand()%15 , $colorList$colorRandom);/ 添加干扰线for($k = 0; $k GetAnimation();
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号