pChart:将图像渲染到浏览器并嵌入html

pChart:将图像渲染到浏览器并嵌入html,html,embed,pchart,Html,Embed,Pchart,我有一个类名“MonthReport.class.php”,其结构如下所示: class MonthReport{ ..... //some member variables public function pieChart(){ ........ //the image data comes from mysql and data belongs to a specified user $myPicture->Str

我有一个类名“MonthReport.class.php”,其结构如下所示:

    class MonthReport{
    .....
    //some member variables


    public function pieChart(){
      ........
      //the image data comes from mysql and data belongs to a specified user
      $myPicture->Stroke();
   }

   public function lineChart(){
      ........
      //the image data comes from mysql and data belongs to a specified user
      $myPicture->Stroke();
  }

   public function render html(){
    $html.=str1<<<
    .....
    //some html code
str1;
   $html.=<<<str2
   <img src="$this->pieChart()" />    //can not work
str2;
  }
}
class-MonthReport{
.....
//一些成员变量
公共职能表(){
........
//图像数据来自mysql,数据属于指定用户
$myPicture->Stroke();
}
公共职能线形图(){
........
//图像数据来自mysql,数据属于指定用户
$myPicture->Stroke();
}
公共函数render html(){

$html.=str1您的问题有点不清楚,但如果您的问题是我假设的问题,那么我以前也有类似的问题(创建的图形只是一个图像,页面的所有其余内容都没有显示)。我的解决方案是使用
pchart
生成一个临时图像,然后将该文件嵌入html中

 $myfilename = "temp_image.png";      // temp file name
 $myPicture = new pImage(700,500,$myData);  

 // other image creation code....


 $myPicture->Render($myfilename);     // generate image "temp_image.png"
 $image_html = '<img src="' . $myfilename . '">';   //generate the link
 print("$htmlline");
$myfilename=“temp\u image.png”//临时文件名
$myPicture=new pImage(700500$myData);
//其他图像创建代码。。。。
$myPicture->Render($myfilename);//生成图像“temp_image.png”
$image\u html='';//生成链接
打印($HTMLINE);

由于你的问题还不清楚,这里再次出现了一些猜测。不过,上述方法对我很有效,使我能够将由
pChart
动态创建的图像嵌入到我的
php
页面中。

你说得对!渲染临时图像可以解决我的问题。但我不想将图片存储在我的web服务器中!我已经找到了解决方案这似乎很愚蠢!谢谢!@tudouya好吧,如果你找到了一个不同的解决方案,请将其作为答案发布在这里,因为我很有兴趣自己找到答案。