原帖由 爆米花1983 于 23-3-2009 09:59 AM 发表 
有人会用php image gd function 写华语字在图案上面吗?请指教,如果有url更好。。谢谢
就跟一般的英文字寫法一的, 只是記得要套用UTF-8的編碼加上Unicode的字體.
- <?php
- $font = 'ARIALUNI.TTF'; // 這是你的Unicode字體
- $str = '這是一段中文字'; // 這個...不用說了吧?
- $filename = 'photo.jpg'; // 這是你要上浮水印的圖
- header("Content-type: image/jpeg");
- $im = imagecreate(250, 30);
- $black = imagecolorallocate($im, 0, 0, 0);
- $white = imagecolorallocate($im, 255, 255, 255);
- imagettftext($im, 10, 0, 10, 20, $white, $font, $str);
- $srcim = imagecreatefromjpeg($filename);
- imagecopymerge($srcim, $im, 0, 0, 0, 0, 250, 30, 50);
- imagejpeg($srcim);
- ?>
复制代码 |