Heim  >  Artikel  >  Backend-Entwicklung  >  php文字水印有关问题

php文字水印有关问题

WBOY
WBOYOriginal
2016-06-13 13:15:30858Durchsuche

求助:php文字水印问题

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?php header("Content-type: image/jpeg");
$image="D:\wamp\www\PKSEO\shuiyin\waterImage.gif";
//取得图片的大小   
$img=GetImageSize($image);   
//$img[2] 中存储的是图片的格式   
switch($img[2])
{   
    case 1:   
        $im=@ImageCreateFormGIF($image);   
        break;
    case 2:   
        $im=@ImageCreateFormJPEG($image);   
        break;
    case 3:   
        $im=@ImageCreateFormPNG($image);   
        break;   
}  
//文字水印   
$tc=imagecolorallocate($im,255,255,255);//颜色   
$str=iconv("gbk","utf-8","新年");//输出内容
imagettftext($im,12,0,20,20,$tc,'C:\WINDOWS\Fonts\SIMSUN.TTC',$str);//写入图片
imagejpeg($im);
imagedestroy($im);
?>


我的文件编码是GBK的!是不是什么地方写错了!
望大家多指导!

------解决方案--------------------
图片上面加水印,css也能实现
------解决方案--------------------
函数是不分大小写的,自己写错了怪谁呢?

ImageCreateFormGIF
imagecreatefromgif
------解决方案--------------------
探讨
函数是不分大小写的,自己写错了怪谁呢?

ImageCreateFormGIF
imagecreatefromgif

------解决方案--------------------
具说区分大小写,可是我一直以来写都觉得大小写不影响。
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn