0

I used pchart created a piechart by "pPie". and used "base64_encode" to encode the png image.

$code = base64_encode(file_get_contents($image_path));
$html = $html . "<td><img src='data:image/png;base64," . $code . "'/></td>\n";

The html can't display my image.I have encoded the image by online tool,I got a different code. but when I used same function to deal with other image(a line chart and a bar chart created by pchart), it worked.Do you why and how to resolve it? Thank you very much.

Hanamaki
  • 29
  • 1
  • 2
  • Why are you base64 encoding the image. Would it not be simpler just to put the path to the image in the src attribute – RiggsFolly Sep 20 '18 at 15:36
  • @RiggsFolly Because I want to make an html file as content of email, I want the image display directly in the email.but I can't put the image online. – Hanamaki Sep 20 '18 at 15:52
  • This answer may help you https://stackoverflow.com/a/9110164/2310830 – RiggsFolly Sep 20 '18 at 16:37

0 Answers0