I have created a chart and I need to add it to my email body. Here I have created a sample bar graph.
$chartConfigArr = array(
'type' => 'bar',
'data' => array(
'labels' => array(2012, 2013, 2014, 2015, 2016),
'datasets' => array(
array(
'label' => 'Users',
'data' => array(120, 60, 50, 180, 120),
)
)
)
);
Now I have encoded the url and pass it to a src and attached in the email body($messagebody).
$chartUrl = 'https://quickchart.io/chart?w=500&h=300&c=' . urlencode($chartConfigArr);
$messagebody.= "Please see the chart below:<br><br><img src=\"$chartUrl\">";
I am not getting any errors, but I cannot see the graph in my email. I can see only a box with a red cross. Can someone show me where I messed the code?
Update:
tried with var_dump()
. Here is the result.
"