2016-07-27 5 views
1

메일을 통해 pChart 2.1.4 라이브러리를 통해 이미지를 보내려고합니다. 라이브러리는 내 WordPress 플러그인 내에서 사용됩니다. pChart로 이미지 렌더링

난 다음 시도 :

/* Create and populate the pData object */ 
$MyData = new pData(); 
for($i=0;$i<=30;$i++) { $MyData->addPoints(rand(1,15),"Probe 1"); } 
$MyData->setSerieTicks("Probe 2",4); 
$MyData->setAxisName(0,"Temperatures"); 

/* Create the pChart object */ 
$myPicture = new pImage(700,230,$MyData); 

/* Turn of Antialiasing */ 
$myPicture->Antialias = FALSE; 

/* Add a border to the picture */ 
$myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0)); 

/* Define the chart area */ 
$myPicture->setGraphArea(60,40,650,200); 

/* Draw the scale */ 
$scaleSettings = array("XMargin"=>10,"YMargin"=>10,"Floating"=>TRUE,"GridR"=>200,"GridG"=>200,"GridB"=>200, "DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE); 
$myPicture->drawScale($scaleSettings); 

/* Write the chart legend */ 
$myPicture->drawLegend(600,20,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL)); 

/* Turn on Antialiasing */ 
$myPicture->Antialias = TRUE; 

/* Enable shadow computing */ 
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); 

/* Draw the area chart */ 
$Threshold = ""; 
$Threshold[] = array("Min"=>0,"Max"=>5,"R"=>207,"G"=>240,"B"=>20,"Alpha"=>70); 
$Threshold[] = array("Min"=>5,"Max"=>10,"R"=>240,"G"=>232,"B"=>20,"Alpha"=>70); 
$Threshold[] = array("Min"=>10,"Max"=>20,"R"=>240,"G"=>191,"B"=>20,"Alpha"=>70); 
$myPicture->drawAreaChart(array("Threshold"=>$Threshold)); 

/* Render the picture (choose the best way) */ 
$today = date("Ymd"); 
$curr_user = wp_get_current_user(); 
$img_name = $today . $curr_user->user_login . ".png"; 
$myPicture->render($img_name); 

//############################################################# 

    //create mail 
    $message.=<<<HTML 
     <tr valign="top" align="center"> 

      <img src='$img_name'> 

     </tr> 
     <tr> 
      <td width="25%" style="width:25%;" valign="top" align="center"> 
HTML; 
이미지는 다음과 같이 표현된다

그러나, 메일의 표시 다음을 참조

<img src="https://ci6.googleusercontent.com/proxy/3y_3IDPObyXLCMINb1aKlZf3gh3yI9X3Co3OVv08MohNWIgv4eTR3bWw3KkcLQ=s0-d-e1-ft#http://20160727admin.png" class="CToWUd"> 

:

enter image description here

내가 뭘 잘못하고 있는거야?

이미지가 저장된 위치는 어디입니까?

답장을 보내 주셔서 감사합니다.

답변

1

나는 조금 늦다는 것을 알고 있지만, 다른 사람들에게도 똑같은 실수를 저지른다. 영업 이익은

<img src="$img_name"> 

그렇지해야

<img src='$img_name'> 

을 사용

는 대신 $ img_name의 가치, IMG의 SRC에 $의 img_name 배치됩니다; 또한 해당 위치에 이미지가 있는지 확인하십시오.