教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 php imagecreate图片生成代码

php imagecreate图片生成代码

发布时间:2016-10-27   编辑:jiaochengji.com
教程集为您提供php imagecreate图片生成代码等资源,欢迎您收藏本站,我们将为您提供最新的php imagecreate图片生成代码资源
php imagecreate图片生成代码


if(isset($gd) && $gd==1 && $txt)
{
 header ("Content-type: image/png");
 $txt = urldecode(phpcms_auth($txt, 'DECODE', AUTH_KEY));
 $imageX = strlen($txt)*9;
 $im = @imagecreate ($imageX, 16) or die ("Cannot Initialize new GD image stream");
 $bgColor = ImageColorAllocate($im,255,255,255);
 $white=imagecolorallocate($im,234,185,95);
 $font_color=imagecolorallocate($im,0x00,0x00,0x00);
 
 $fontfile = PHPCMS_ROOT."include/fonts/simfang.ttf";
 if(file_exists($fontfile) && !preg_match('/([a-z0-9@.])/',$txt))
 {
  $txt = iconv("GB2312","UTF-8",$txt);
  ImageTTFText($im, 10, 0, 0, 12, $font_color, $fontfile, $txt);
 }
 else
 {
  $fonttype = intval($fonttype);
  imagestring ($im, $fonttype, 0, 0,$txt, $font_color);
 }
 imagepng ($im);
 imagedestroy ($im);
}

您可能感兴趣的文章:
php imagecreate图片生成代码
php验证码的三个实例代码分享
php随机生成4位数字验证码
php生成验证码
PHP版的验证码程序
php 验证码实例代码
用php生成带有雪花背景的验证码
图形数字验证代码
php生成动态图片验证码的一段代码
用PHP实现验证码功能

[关闭]
~ ~