[請益] php圖片顯示中文

看板PHP作者 (dcplay)時間18年前 (2008/01/28 17:26), 編輯推噓1(103)
留言4則, 2人參與, 最新討論串1/1
<?php require_once("ChartDirector/lib/phpchartdir.php"); # The data for the line chart @mysql_connect("localhost","junwi","33338888") or die("sorry"); $str = "SELECT c1.course_name,j1.grade FROM joinclass j1 JOIN courses c1 ON j1.course_id = c1.course_id WHERE c1.course_id LIKE '%w' AND j1.stu_id =93101163" ; $result = @mysql_db_query("sample",$str) or die("die"); $number = mysql_num_rows($result); for ($i=1; $i<=$number; $i++) { $fo = mysql_fetch_object($result); $labels[]=$fo->course_name; $ydata[]=$fo->grade; } # Create a XYChart object of size 300 x 280 pixels $c = new XYChart(300, 280); # Set the plotarea at (45, 30) and of size 200 x 200 pixels $c->setPlotArea(45, 30, 200, 200); # Add a title to the chart using 12 pts Arial Bold Italic font $c->addTitle("Web Grade", "arialbi.ttf", 12); # Add a title to the y axis $c->yAxis->setTitle("Web point"); # Add a title to the x axis $c->xAxis->setTitle("Course name"); # Add a blue (0x6666ff) 3D line chart layer using the give data $lineLayerObj = $c->addLineLayer($ydata, 0x6666ff); $lineLayerObj->set3D(); # Set the labels on the x axis. $c->xAxis->setLabels($labels); # output the chart header("Content-type: image/png"); print($c->makeChart2(PNG)); ?> 結果如下: http://www.badongo.com/pic/2800813 想在X軸上把???(中文)的地方 顯示出來...不知道要改哪邊@@ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.170.65.181

01/29 08:20, , 1F
問題出在 GD 處理中文文字的能力。
01/29 08:20, 1F

01/29 08:20, , 2F
你要會改寫你用的 library ,改法可在 google 搜尋。
01/29 08:20, 2F

01/29 08:21, , 3F
關鍵字是「GD 中文」。
01/29 08:21, 3F

01/29 15:21, , 4F
可是好像要修改套件的函式庫...
01/29 15:21, 4F
文章代碼(AID): #17dP_GU1 (PHP)
文章代碼(AID): #17dP_GU1 (PHP)