http://www.veryhd.com/pig/?txt=哈哈<?php
header ("Content-type: image/png");
require ("pig.php");
$txt=show_txt();
$txt1=subStr($txt,0,30);
$txt2=subStr($txt,30,30);
$image = @imagecreatefromgif ("pig.gif");
$white = imagecolorallocate ($image, 255, 255, 255);
drawer($image,$txt1,12,12,$white);
drawer($image,$txt2,12,36,$white);
imagepng ($image);
imagedestroy ($image);
function show_txt(){
$bbb = $_GET['txt'];
return($bbb);
}
?>
header ("Content-type: image/png");
require ("pig.php");
$txt=show_txt();
$txt1=subStr($txt,0,30);
$txt2=subStr($txt,30,30);
$image = @imagecreatefromgif ("pig.gif");
$white = imagecolorallocate ($image, 255, 255, 255);
drawer($image,$txt1,12,12,$white);
drawer($image,$txt2,12,36,$white);
imagepng ($image);
imagedestroy ($image);
function show_txt(){
$bbb = $_GET['txt'];
return($bbb);
}
?>
我的两个页面是这样的
###gd.php
<?php Header("Content-type: image/png");
$width = 7.5*(strlen($_GET["text"]))+100;
$text = $_GET["text"];
$height = 21;
$newim = imagecreate($width,$height);
$gray = imagecolorallocate($newim,153,153,153);
$white = ImageColorAllocate($newim,255,255,255);
imagefilledrectangle($newim,1,1,$width-96,19,$white);
$email = imagecreatefrompng('gmail.png');
imagecopy($newim,$email,$width-100,0,1,0,100,21);
imagestring($newim, 3, 7, 3, $text, $gray);
imagepng($newim);
imagedestroy($newim);?> ###index.php
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head><body>
<p>请输入你的Gmail地址:</p>
<form action="index.php" method="get" name="email">
<input type="text" name="text" width="100">@gmail.com
<input type="submit" value="创建我的签名">
</form><table style="display:<?php if(empty($_GET["text"])) echo "none;";?>"><tr><td>
<img src="gd.php?text=<?php echo $_GET["text"]?>" >
</td></tr></table></body>
</html>
我把编码改为utf-8,中文是显出来了,可还是有问题,我用的是simhei,总是显示最后一个字出现乱码,我试了你的http://www.veryhd.com/pig/?txt=哈哈
显示的一切正常,能说一下pig.php里做了什么处理吗?