php imagecreate图片生成代码
2014-08-07 13:31
274 查看
f(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);
}
&& $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生成验证码图片代码
- 利用PHP为大图片生成缩略图代码实现
- php 读取指定字符中间内容代码
- PHP 图片上传生成缩略图代码
- 基于GD2图形库的PHP生成图片缩略图类代码分享
- php下让文本生成图片的代码
- phpcms v9常用实用代码集合
- jquery+php+ajax显示上传进度的多图片上传并生成缩略图代码
- php生成GIF动态验证码图片(代码家园)
- 结合Mod Rewrite以及PHP生成…
- js+php实现的图片选框手动裁剪生成缩略图代码
- php 对图片的验证操作
- 随机字符串生成图片 PHP代码
- jquery+php+ajax显示上传进度的多图片上传并生成缩略图代码
- php生成SessionID和图片校验码的思路和实现代码
- php 生成随机验证码图片代码
- php[周六代码分享]:php+html&nbsp…
- php 里面摸拟post请求的代码
- 基于GD2图形库的PHP生成图片缩略图类代码分享
- php文字生成图片以及给图片加水印流程及代码详解