开发者

pChart does not render to web browser, only shows missing image

pCharts documentation says that you should be able to render the image to the browser using this code.

mypic.php

$myPicture->stroke;

mypage.html

<IMG SRC=‘mypic.php‘>

The img tag is supposed to invoke the php script. Within the PHP script, the stroke function se开发者_运维问答ts the content-type: image/png.

So here is what I have:

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>

I'm not getting any errors, just the red X for a missing image.


try removing the

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

From index.php, and add

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

Before the Stroke call.


I try something like this and works:

//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"); 

?>
///////////////////////////////////


I just got it working for me I had comment include function in HTML file:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜