2011-02-23 35 views
1

pCharts文檔說,您應該能夠使用此代碼將圖像呈現給瀏覽器。pChart不呈現給網絡瀏覽器,只顯示丟失的圖像

mypic.php

$myPicture->stroke; 

的mypage.html

<IMG SRC=‘mypic.php‘> 

img標籤應該調用PHP腳本。在PHP腳本中,筆劃函數設置content-type: image/png

因此,這裏是我:

netsales.php

<?php 
    include('../class/pData.class.php'); 
    include('../class/pDraw.class.php'); 
    include('../class/pImage.class.php'); 

    /* query sales and create new image */ 

    $myPicture->stroke; 
?> 

的index.php

<?php 
    include ('netsales.php'); 
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
</head> 
<body> 
    <div> 
      <img src="netsales.php" /> 
    </div> 
</body> 
</html> 

我沒有得到任何錯誤,只是紅色的X爲失蹤圖片。

+1

是'stroke'不是一個功能?所以試試'$ myPicture-> stroke();'? – thirtydot 2011-02-23 15:40:23

回答

1

嘗試刪除

<?php 
    include ('netsales.php'); 
?> 

從index.php文件,並添加

header('Content-Type: image/png'); 

卒中電話之前。

0

我嘗試這樣的事情和工作原理:

//html file////////////////////// 
<?php include ('my.php'); ?> 

<html> 
<head></head> 
<body> 

<div> <img src="my.php" /> </div> 

</body> 

</html> 
/////////////////////////////////// 


//my.php file///////////////////////// 
<?php 

/* pChart library inclusions */ 
include("pChart/class/pData.class.php"); 
include("pChart/class/pDraw.class.php"); 
include("pChart/class/pImage.class.php"); 


//... 


$myPicture->autoOutput("picture.png"); 

?> 
/////////////////////////////////// 
0

我剛剛纔爲我工作我曾評論功能包括在HTML文件中:

<?php //include ('my.php'); ?>