Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,038

HOME > PHP > PHP Forum > สอบถามเรื่อง JpGraph อัพโหลดแล้ว Error ครับ คือตอนที่ ทำในเครื่อง แสดงผลได้ปกติครับ


[PHP] สอบถามเรื่อง JpGraph อัพโหลดแล้ว Error ครับ คือตอนที่ ทำในเครื่อง แสดงผลได้ปกติครับ

 
Topic : 042664



โพสกระทู้ ( 42 )
บทความ ( 0 )



สถานะออฟไลน์



คือตอนที่ ทำในเครื่อง แสดงผลได้ปกติครับ แต่ตอนอัพขึ้นhost ขึ้น


Code
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/usr/share/fonts/truetype/arial.ttf) is not within the allowed path(s): (/home/testgraph/:/tmp:/usr/local/lib/php/) in /home/test/domains/testgraph.com/public_html/func/jpgraph/jpgraph_ttf.inc.php on line 497
JpGraph Error: 25049 Font file "/usr/share/fonts/truetype/arial.ttf" is not readable or does not exist.


ไม่ทราบว่าผมทำผิดพลาดตรงไหนครับ ขอบคุณมาก



Tag : - - - -

Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-05-10 16:12:07 By : sagon View : 2947 Reply : 12
 

 

No. 1



โพสกระทู้ ( 42 )
บทความ ( 0 )



สถานะออฟไลน์


code ครับ
Code (PHP)
001.<?php
002.include ("jpgraph/jpgraph.php");
003.include ("jpgraph/jpgraph_line.php");
004. 
005.$graphname = 'Report/';
006.$xlinename = 'date';
007.$ylinename ='Piece';
008. 
009.//ใส่ชื่อเส้น
010.$lg1 = "max1";
011.$lg2 = "max2";
012.$lg3 = "max3";
013.$lg4 = "min";
014. 
015.$ydatamax1 = array(25,40,60,21,33,25,14,88,99,52,14,12);
016.$ydatamax2= array(15,55,80,15,66,20,11,30,60,60,90,20);
017.$ydatamax3 = array(10,75,89,15,22,20,11,90,60,10,11,60);
018.$ydatamin1 = array(1,3,2,5,4,8,1,2,4,5,1,9);
019.$xmouth = array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
020.$xdate1 = array("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31");
021.$xdate2 = array("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30");
022.$xdate3 = array("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29");
023.$selectx = 1;
024.switch ($selectx) {
025.case 1:
026.    $xdata = $xmouth;
027.    $xlinename = 'Month';
028.    $graphname = 'Month';
029.    break;
030.case 2:
031.    $xdata = $xdate1;
032.    $graphname = 'Date';
033.    break;
034.case 3:
035.    $xdata = $xdate2;
036.    $graphname = 'Date';
037.    break;
038.case 4:
039.    $xdata = $xdate3;
040.    $graphname = 'Date';
041.    break;
042.}
043. 
044.$mygraph = new Graph(800,500,"auto");
045.$mygraph->SetScale("textlin");
046.$mygraph->SetMargin(40,140,30,50);
047.$mygraph->title->Set($graphname);
048. 
049.$mygraph->xaxis->title->set($xlinename);
050.$mygraph->yaxis->title->set($ylinename);
051.$mygraph->xgrid->Show();
052.$mygraph->ygrid->SetFill(true,'white@0.2','lavender');
053.$mygraph->SetShadow();
054. 
055.$mygraph->title->SetFont(FF_FONT1,FS_BOLD,15);
056.$mygraph->title->SetColor("black");
057. 
058.$mygraph->xaxis->SetTitlemargin(18);
059.$mygraph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
060.$mygraph->xaxis->title->SetColor("black");
061.$mygraph->xaxis->title->SetFont(FF_TIMES,FS_BOLD,12);
062.$mygraph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,10);
063.$mygraph->xaxis->SetLabelAngle(45);
064.//$mygraph->xaxis->SetTextLabelInterval(2);
065.$mygraph->xaxis->SetWeight(3);
066. 
067.$mygraph->yaxis->SetTitlemargin(18);
068.$mygraph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
069.$mygraph->yaxis->title->SetColor("black");
070.$mygraph->yaxis->title->SetFont(FF_TIMES,FS_BOLD,12);
071.$mygraph->yaxis->SetWeight(3);
072.$mygraph->img->SetAntiAliasing();
073.$mygraph->xaxis->SetTickLabels($xdata);
074.$linemax1 = new LinePlot($ydatamax1);
075.$linemax1 -> SetColor("red");
076.$linemax1 ->SetWeight(2);
077.$linemax1 ->value->Show();
078.$linemax1 ->value->SetColor("red");
079.$linemax1 ->value->SetFont(FF_FONT1);
080.$linemax1->SetLegend($lg1);
081. 
082.$linemax2 = new LinePlot($ydatamax2);
083.$linemax2 -> SetColor("blue");
084.$linemax2 ->SetWeight(2);
085.$linemax2 ->value->Show();
086.$linemax2 ->value->SetColor("blue");
087.$linemax2 ->value->SetFont(FF_FONT1);
088.$linemax2->SetLegend($lg2);
089. 
090.$linemax3 = new LinePlot($ydatamax3);
091.$linemax3 -> SetColor("green");
092.$linemax3 ->SetWeight(2);
093.$linemax3 ->value->Show();
094.$linemax3 ->value->SetColor("green");
095.$linemax3 ->value->SetFont(FF_FONT1);
096.$linemax3->SetLegend($lg3);
097. 
098.$linemin1 = new LinePlot($ydatamin1);
099.$linemin1 -> SetColor("black");
100.$linemin1 ->SetWeight(2);
101.$linemin1 ->value->Show();
102.$linemin1 ->value->SetColor("black");
103.$linemin1 ->value->SetFont(FF_FONT1);
104.$linemin1->SetLegend($lg4);
105. 
106.$mygraph->Add($linemax1);
107.$mygraph->Add($linemax2);
108.$mygraph->Add($linemax3);
109.$mygraph->Add($linemin1);
110.$mygraph->Stroke();
111. 
112.?>

Date : 2010-05-10 19:49:57 By : sagon
 

 

No. 2



โพสกระทู้ ( 42 )
บทความ ( 0 )



สถานะออฟไลน์


งะมะมีท่านใดตอบ T-T
Date : 2010-05-11 21:06:53 By : sagon
 

 

No. 3

Guest


ผมไม่เคยใช้หรอก จาก อ่านดูแล้ว ผมว่าลอง อัพฟอนต์ขึ้นไปเอง สิครับ แล้วเซตฟอนต์ ด้วยนะครับ
Date : 2010-05-11 21:30:52 By : เอี่ยว ^^
 

 

No. 4



โพสกระทู้ ( 1,463 )
บทความ ( 1 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Blogger

ประกาศ folder ที่เก็บ font

defined('TTF_DIR',dirname(__FILE__).'/fonts/');

test.php
001.<?php
002.include ("jpgraph/jpgraph.php");
003.include ("jpgraph/jpgraph_line.php");
004. 
005.defined('TTF_DIR',dirname(__FILE__).'/fonts/');
006. 
007.$graphname = 'Report/';
008.$xlinename = 'date';
009.$ylinename ='Piece';
010. 
011.//ใส่ชื่อเส้น
012.$lg1 = "max1";
013.$lg2 = "max2";
014.$lg3 = "max3";
015.$lg4 = "min";
016. 
017.$ydatamax1 = array(25,40,60,21,33,25,14,88,99,52,14,12);
018.$ydatamax2= array(15,55,80,15,66,20,11,30,60,60,90,20);
019.$ydatamax3 = array(10,75,89,15,22,20,11,90,60,10,11,60);
020.$ydatamin1 = array(1,3,2,5,4,8,1,2,4,5,1,9);
021.$xmouth = array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
022.$xdate1 = array("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31");
023.$xdate2 = array("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30");
024.$xdate3 = array("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29");
025.$selectx = 1;
026.switch ($selectx) {
027.case 1:
028.    $xdata = $xmouth;
029.    $xlinename = 'Month';
030.    $graphname = 'Month';
031.    break;
032.case 2:
033.    $xdata = $xdate1;
034.    $graphname = 'Date';
035.    break;
036.case 3:
037.    $xdata = $xdate2;
038.    $graphname = 'Date';
039.    break;
040.case 4:
041.    $xdata = $xdate3;
042.    $graphname = 'Date';
043.    break;
044.}
045. 
046.$mygraph = new Graph(800,500,"auto");
047.$mygraph->SetScale("textlin");
048.$mygraph->SetMargin(40,140,30,50);
049.$mygraph->title->Set($graphname);
050. 
051.$mygraph->xaxis->title->set($xlinename);
052.$mygraph->yaxis->title->set($ylinename);
053.$mygraph->xgrid->Show();
054.$mygraph->ygrid->SetFill(true,'white@0.2','lavender');
055.$mygraph->SetShadow();
056. 
057.$mygraph->title->SetFont(FF_FONT1,FS_BOLD,15);
058.$mygraph->title->SetColor("black");
059. 
060.$mygraph->xaxis->SetTitlemargin(18);
061.$mygraph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
062.$mygraph->xaxis->title->SetColor("black");
063.$mygraph->xaxis->title->SetFont(FF_TIMES,FS_BOLD,12);
064.$mygraph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,10);
065.$mygraph->xaxis->SetLabelAngle(45);
066.//$mygraph->xaxis->SetTextLabelInterval(2);
067.$mygraph->xaxis->SetWeight(3);
068. 
069.$mygraph->yaxis->SetTitlemargin(18);
070.$mygraph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
071.$mygraph->yaxis->title->SetColor("black");
072.$mygraph->yaxis->title->SetFont(FF_TIMES,FS_BOLD,12);
073.$mygraph->yaxis->SetWeight(3);
074.$mygraph->img->SetAntiAliasing();
075.$mygraph->xaxis->SetTickLabels($xdata);
076.$linemax1 = new LinePlot($ydatamax1);
077.$linemax1 -> SetColor("red");
078.$linemax1 ->SetWeight(2);
079.$linemax1 ->value->Show();
080.$linemax1 ->value->SetColor("red");
081.$linemax1 ->value->SetFont(FF_FONT1);
082.$linemax1->SetLegend($lg1);
083. 
084.$linemax2 = new LinePlot($ydatamax2);
085.$linemax2 -> SetColor("blue");
086.$linemax2 ->SetWeight(2);
087.$linemax2 ->value->Show();
088.$linemax2 ->value->SetColor("blue");
089.$linemax2 ->value->SetFont(FF_FONT1);
090.$linemax2->SetLegend($lg2);
091. 
092.$linemax3 = new LinePlot($ydatamax3);
093.$linemax3 -> SetColor("green");
094.$linemax3 ->SetWeight(2);
095.$linemax3 ->value->Show();
096.$linemax3 ->value->SetColor("green");
097.$linemax3 ->value->SetFont(FF_FONT1);
098.$linemax3->SetLegend($lg3);
099. 
100.$linemin1 = new LinePlot($ydatamin1);
101.$linemin1 -> SetColor("black");
102.$linemin1 ->SetWeight(2);
103.$linemin1 ->value->Show();
104.$linemin1 ->value->SetColor("black");
105.$linemin1 ->value->SetFont(FF_FONT1);
106.$linemin1->SetLegend($lg4);
107. 
108.$mygraph->Add($linemax1);
109.$mygraph->Add($linemax2);
110.$mygraph->Add($linemax3);
111.$mygraph->Add($linemin1);
112.$mygraph->Stroke();
113. 
114.?>


แล้วเอา font arial.ttf ไปใส่ไว้ใน folder /fonts (folder ที่อยู่ระดับเดียวกับ test.php)

อ่านวิธี copy .ttf มาไช้ได้ที่ https://www.thaicreate.com/php/forum/041909.html ครับ
Date : 2010-05-11 22:02:06 By : num
 

 

No. 5



โพสกระทู้ ( 42 )
บทความ ( 0 )



สถานะออฟไลน์


Upload

ขอบคุณคุณ num กับ Guestครับ
ผมก็อป font ลง folder fonts แล้วครับ เก็บในfolder เดียวกับ test.php (เปลี่ยนเป็นgrahpgen.php)ก็อป code จาก คุณ num
มันขึ้นแบบนี้ครับ ผม พลาดตรงไหนครับ
Date : 2010-05-12 14:59:54 By : sagon
 

 

No. 6

Guest


ผมเขียนชื่อ function ผิดครับโทษที defined() --> define()
Date : 2010-05-12 17:12:11 By : num
 

 

No. 7



โพสกระทู้ ( 42 )
บทความ ( 0 )



สถานะออฟไลน์


กลับไปเป็น เหมือนเดิม ในเครื่องแสดงปกติ พออัพขึ้นhost ขึ้นerror


Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/usr/share/fonts/truetype/arial.ttf) is not within the allowed path(s): (/home/testgraph/:/tmp:/usr/local/lib/php/) in /home/test/domains/testgraph.com/public_html/func/jpgraph/jpgraph_ttf.inc.php on line 497
JpGraph Error: 25049 Font file "/usr/share/fonts/truetype/arial.ttf" is not readable or does not exist.

เหมือนเดิมครับ พอเปลี่ยน font ก็แค่เปลี่ยนชื่อfont แต่error เหมือนเดิม T-T
Date : 2010-05-12 20:05:47 By : sagon
 

 

No. 8

Guest


เอาไว้ก่อน include จะได้เป่าครับ


define('TTF_DIR',dirname(__FILE__).'/fonts/');
include ("jpgraph/jpgraph.php");
include ("jpgraph/jpgraph_line.php");
Date : 2010-05-12 21:04:12 By : num
 

 

No. 9



โพสกระทู้ ( 42 )
บทความ ( 0 )



สถานะออฟไลน์


สำเร็จแล้วครับ!!!!!!!!!
ขอบคุณ มากๆเลยครับ!!!!!!!!!!
Date : 2010-05-12 23:35:24 By : sagon
 

 

No. 10



โพสกระทู้ ( 31 )
บทความ ( 0 )



สถานะออฟไลน์


ผมมีปัญหาเดียวกัน แต่ก็แก้วแล้วครับแต่ยังไม่ได้
Date : 2010-10-30 17:43:41 By : chansaad
 

 

No. 11

Guest


http://web-programming-bookmark.blogspot.com/2010/10/set-folder-font-jpgraph.html
ดาวน์โหลดตัวอย่างไปทดสอบได้เลยครับ
Date : 2010-10-30 21:58:35 By : num
 

 

No. 12



โพสกระทู้ ( 515 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

หน้าสนใจ


ประวัติการแก้ไข
2010-11-05 15:38:49
Date : 2010-11-05 15:38:15 By : deedee2338
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : สอบถามเรื่อง JpGraph อัพโหลดแล้ว Error ครับ คือตอนที่ ทำในเครื่อง แสดงผลได้ปกติครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)





ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2025 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่