參考連結: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呢???
版主: 版主管理群
代碼: 選擇全部
ImageTTFText($img, 9, 0, $left, $top, $text_color, "C:/WINNT/Fonts/mingliu.ttc",big52uni("$text"));
代碼: 選擇全部
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代碼: 選擇全部
ImageTTFText($img, 9, 0, $left, $top, $text_color, "MINGLIU.TTC",big52uni("$text"));
代碼: 選擇全部
<?
//中文化 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
?>