imagettftext函數在windows下中文顯示正常,在linux下中文就出現了亂碼。。。
核心代碼如下:
//此處省略N行。。。$image = imagecreatetruecolor($width, $height);$color = imagecolorallocate($image, $red, $green, $blue);imagefill($image, 0, 0, $color);$tcolor = imagecolorallocate($image, $tred, $tgreen, $tblue);//imagestring ($image, $fontfile, 20 , 20 , "Hello world!" , $tcolor);//echo floor(($height - $fontinfo['height']) / 2);die;imagettftext($image, $tsize, 0, ($width - $fontinfo['width']) / 2, $height / 2, $tcolor, $fontfile, $text);//此處省略N行。。。
轉碼什麼的都試過了,不行!也覺得不是編碼的問題。。。
linux下也已經安裝了msyh.ttf字型。。。
windows下顯示:
linux下顯示:
還望各位兄弟姐妹看看,小弟先謝過了!
回複內容:
imagettftext函數在windows下中文顯示正常,在linux下中文就出現了亂碼。。。
核心代碼如下:
//此處省略N行。。。$image = imagecreatetruecolor($width, $height);$color = imagecolorallocate($image, $red, $green, $blue);imagefill($image, 0, 0, $color);$tcolor = imagecolorallocate($image, $tred, $tgreen, $tblue);//imagestring ($image, $fontfile, 20 , 20 , "Hello world!" , $tcolor);//echo floor(($height - $fontinfo['height']) / 2);die;imagettftext($image, $tsize, 0, ($width - $fontinfo['width']) / 2, $height / 2, $tcolor, $fontfile, $text);//此處省略N行。。。
轉碼什麼的都試過了,不行!也覺得不是編碼的問題。。。
linux下也已經安裝了msyh.ttf字型。。。
windows下顯示:
linux下顯示:
還望各位兄弟姐妹看看,小弟先謝過了!
%e6%88%91
是urlencode('我')
的結果,是不是通過URL進行參數傳遞沒有解碼的問題。
我很奇怪windows上是白色的,怎麼Linux下就黃了。。
圖片浮水印出現亂碼,一般是兩個問題。
編碼不統一,那就統一一下,啟用JIS-mapped Japanese Font Support了,就關閉即可。
什嗎?你說JIS-mapped Japanese Font Support怎麼關閉?
我的方法是重新編譯php-gd拓展。
確認過了
檔案編碼是一致的;
編譯參數沒有加 --enable-gd-jis-conv的;
windows下測試正常就直接上傳到linux伺服器了。。。