第 1 頁 (共 2 頁)
[問題]論壇狀態簽名檔0.3可顯示中文
發表於 : 2004-03-15 12:43
由 jackyct1
問題外掛:論壇狀態簽名檔0.3可顯示中文
參考連結:
http://phpbb-tw.net/phpbb/viewtopic.php?t=22966
使用版本:phpBB 2.0.6
狀況描述:
我裝它的時候,發現signature.php有一句:
代碼: 選擇全部
ImageTTFText($img, 9, 0, $left, $top, $text_color, "C:/WINNT/Fonts/mingliu.ttc",big52uni("$text"));
我想,不一定所有人都是用windows NT吧?
那請問如何修改才可以支援所有的windows呢???
發表於 : 2004-03-15 12:52
由 GeniusKiKi
您都不看說明的嗎?
請將該路徑逕行改為您字型檔案所在位置
發表於 : 2004-03-15 12:59
由 jackyct1
GeniusKiKi 寫:您都不看說明的嗎?
請將該路徑逕行改為您字型檔案所在位置
我有看....
不過我不明白它的意思....
我的目錄跟別人的不同,為什麼別人又會load到那個字型呢...
發表於 : 2004-03-15 16:49
由 夢幻LUGIA
我越看越迷糊了|||
每個人的狀況都不一樣...要自己改\r
路徑跟預設不一樣的人也是有去改吧...
要不然怎麼執行〈汗
發表於 : 2004-03-15 18:35
由 jackyct1
我剛剛把那段code改成:
代碼: 選擇全部
ImageTTFText($img, 9, 0, $left, $top, $text_color, "C:/WINDOWS/FONTS/MINGLIU.TTC",big52uni("$text"));
這個是我的電腦的目錄,但是它出現了:
代碼: 選擇全部
Warning: imagettftext(): Could not find/open font in /home/.sites/33/site5/web/phpbb2/signature/signature.php on line 73
Warning: Cannot modify header information - headers already sent by (output started at /home/.sites/33/site5/web/phpbb2/signature/signature.php:73) in /home/.sites/33/site5/web/phpbb2/signature/signature.php on line 75
好像是font錯誤吧...
但我在自己主機架的時候又成功...
請問是什麼原因....?
發表於 : 2004-03-15 18:42
由 aiken
你沒有把主機的資料說清楚 鬼才知道什麼原因
在自己的主機架的時候成功...那你現在又架到哪裡去了...
要人猜....元宵節已經過了...
徹底解決的方法
把你的字型檔案複製到跟 signture.php 相同的目錄
改成
代碼: 選擇全部
ImageTTFText($img, 9, 0, $left, $top, $text_color, "MINGLIU.TTC",big52uni("$text"));
發表於 : 2004-03-15 18:56
由 jackyct1
我想問的是不在主機架的情形,
所以我沒有說到主機資料.
MINGLIU.TTC有6.73 mb,load起來會不會變慢..?
發表於 : 2004-03-15 20:43
由 GeniusKiKi
jackyct1 寫:我有看....
不過我不明白它的意思....
我的目錄跟別人的不同,為什麼別人又會load到那個字型呢...
那一行是呼叫該程序所在主機內的字型檔...
跟瀏覽的使用者使用的作業系統完全無關...
\n總之就是改成您架設的主機上字形的所在位置...
發表於 : 2004-03-15 21:18
由 jackyct1
GeniusKiKi 寫:jackyct1 寫:我有看....
不過我不明白它的意思....
我的目錄跟別人的不同,為什麼別人又會load到那個字型呢...
那一行是呼叫該程序所在主機內的字型檔...
跟瀏覽的使用者使用的作業系統完全無關...
總之就是改成您架設的主機上字形的所在位置...
原來是這樣...
那我裝英文版的好啦~^^"...
發表於 : 2004-03-15 21:27
由 aiken
裝英文版的...
那你的文章主題都會是亂碼唷...
除非你不顯示最新的文章主題
可以考慮看看裝舊版的即時狀態簽名檔
發表於 : 2004-03-20 09:04
由 jackyct1
aiken 寫:裝英文版的...
那你的文章主題都會是亂碼唷...
除非你不顯示最新的文章主題
可以考慮看看裝舊版的即時狀態簽名檔
我剛剛真的把整個6 mb的mingliu.ttf上傳到網上..
雖然顯示成功,不過出現字是亂碼...

發表於 : 2004-03-20 11:37
由 aiken
要先確定你的主機有支援 ICONV
不然就會這樣
發表於 : 2004-03-20 15:20
由 jackyct1
我確定那個主機支援iconv了~*
代碼: 選擇全部
iconv
iconv support enabled
iconv implementation glibc
iconv library version 2.2.3
發表於 : 2004-03-20 15:26
由 aiken
把你的 signature.php 貼出來看看
記得要用
發表於 : 2004-03-20 16:09
由 jackyct1
代碼: 選擇全部
<?
//中文化 BY 銀薰 http://mybell.myftp.org/phpbb2/
//參考網頁http://freebsd.sinica.edu.tw/~statue/zh-tut/php-imagettftext.html Mowd提供
/* need iconv module */
function big52uni($text) {
$rtext="";
$max=strlen($text);
for($i=0;$i<$max;$i++){
$h=ord($text[$i]);
if($h>=150 && $i<$max-1){
$rtext.="&#".base_convert(bin2hex(iconv("big5","ucs-2",
substr($text,$i,2))),16,10).";";
$i++;
}else{
$rtext.=$text[$i];
}
}
return $rtext;
}
//
// Configuration
//
$width = 365; //圖片寬度
$height = 30; //圖片高度\r
$left = 10; //文字距離\r
$top = 25; //文字高度\r
$spacing = 11; //Line spacing of stats text
$signImage = "sign.jpg"; //底圖名稱\r
$newImage = "burnz.jpg"; //生成的論壇狀態圖(就是加上論壇狀況的圖啦.. 這圖不會即時更新 搞不懂原作者為啥弄個這個出來)
$compression = 100; //壓縮簽名檔圖像 (100 = 不壓縮)
define('IN_PHPBB', true);
$phpbb_root_path = '../'; //請對映到PHPBB的資料夾\r
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$total_topics = get_db_stat('topiccount');
$text = "會員: $total_users 主題: $total_topics 文章: $total_posts
";
$writeImage = split("
", $text);
if(is_array($writeImage)){
$i = 0;
foreach($writeImage as $writtenImage){
$i++;
$output[$i] = $writtenImage;
}
}
$tmpImage = imagecreatefromjpeg($signImage);
$img = imagecreate($width,$height);\r
$bg_color = imagecolorallocate ($img, 255, 255, 255);//RGB values - 底色吧.....
$text_color = imagecolorallocate ($img, 0, 0, 0);//RGB values - 文字顏色\r
imagefilledrectangle ($img, 0, 0, $width, $height, $bg_color);
imagecopy ($img, $tmpImage, 0, 0, 0, 0, $width, $height); // Copy stats
imagecolortransparent($img, $bg_color); // 設定底色透明
//$i = 0;
//while($i < count($output)){
//imagestring($img, 2, $left, (($i * $spacing) - $spacing + $top), $output[$i], $text_color);
//$i++;
//}
ImageTTFText($img, 9, 0, $left, $top, $text_color, "../mingliu.ttc",big52uni("$text"));
header("Content-Type: image/png");
imagepng($img);
imagejpeg($img, $newImage, $compression);
imagedestroy($img); // get the image out of memory
?>