<?php // Set the content-type header("Content-type: image/png"); // Create the image $im = imagecreatetruecolor(400,30); // Create some colors $white = imagecolorallocate($im,255,255,255); $grey = imagecolorallocate($im,128,128,128); $black = imagecolorallocate($im,0,0,0); // The text to draw //$text = '扬帆'; $text=iconv("gbk","utf-8","新年");//输出内容 // Replace path by your own font path $font = 'C:\WINDOWS\Fonts\SIMSUN.TTC'; // Add some shadow to the text imagettftext($im, 20, 0, 11, 21,$grey,$font,$text); // Add the text imagettftext($im, 20, 0, 10, 20,$white,$font,$text); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im); ?> 我现在改成这样了!可以打中文字 并且不出现乱码 但是我要在图片上水印文字。又出现乱码! 请问应该怎么样写?
我现在改成这样还是不行: 大家帮我想想办法!谢谢! <?php // Set the content-type header("Content-type: image/png"); // Create the image $image="D:\wamp\www\PKSEO\shuiyin\waterImage.gif"; $im=@ImageCreateFormGIF($image); //取得图片的大小 // Create some colors $white = imagecolorallocate($im,255,255,255); $grey = imagecolorallocate($im,128,128,128); $black = imagecolorallocate($im,0,0,0); // The text to draw $text=iconv("gbk","utf-8","新年");//输出内容 // Replace path by your own font path $font = 'C:\WINDOWS\Fonts\SIMSUN.TTC'; // Add some shadow to the text imagettftext($im, 20, 0, 11, 21,$grey,$font,$text); // Add the text imagettftext($im, 20, 0, 10, 20,$white,$font,$text); // Using imagepng() results in clearer text compared with imagejpeg() imagegif($im); imagedestroy($im); ?>
<?php
// Set the content-type
header("Content-type: image/png");
// Create the image
$im = imagecreatetruecolor(400,30);
// Create some colors
$white = imagecolorallocate($im,255,255,255);
$grey = imagecolorallocate($im,128,128,128);
$black = imagecolorallocate($im,0,0,0);
// The text to draw
//$text = '扬帆';
$text=iconv("gbk","utf-8","新年");//输出内容
// Replace path by your own font path
$font = 'C:\WINDOWS\Fonts\SIMSUN.TTC';
// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21,$grey,$font,$text);
// Add the text
imagettftext($im, 20, 0, 10, 20,$white,$font,$text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?> 我现在改成这样了!可以打中文字 并且不出现乱码
但是我要在图片上水印文字。又出现乱码!
请问应该怎么样写?
大家帮我想想办法!谢谢!
<?php
// Set the content-type
header("Content-type: image/png");
// Create the image
$image="D:\wamp\www\PKSEO\shuiyin\waterImage.gif";
$im=@ImageCreateFormGIF($image);
//取得图片的大小
// Create some colors
$white = imagecolorallocate($im,255,255,255);
$grey = imagecolorallocate($im,128,128,128);
$black = imagecolorallocate($im,0,0,0);
// The text to draw
$text=iconv("gbk","utf-8","新年");//输出内容
// Replace path by your own font path
$font = 'C:\WINDOWS\Fonts\SIMSUN.TTC';
// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21,$grey,$font,$text);
// Add the text
imagettftext($im, 20, 0, 10, 20,$white,$font,$text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagegif($im);
imagedestroy($im);
?>
可是我用的是PHP 再说现在很多浏览器还不支持CSS3!
只能用水印的办法了!
$im=@ImageCreateFormGIF($image); 错误写法
$im=imagecreatefromgif($image);正确写法
难道PHP还区分大小写!
imagecreatefromgif