Hi Marco,
I have never used lavarel + blade before. Would you mind to inform me how your use the example in lavarel + blade?
If lavarel + blade is used to create a HTML web page, then the normal method to insert an image into a web page is to use an <IMG> tag. It is the same whether it is a static image or a chart image. The code is like:
<img src="/path/to/percentbar.php">
If you are using lavarel + blade to output the chart image to the browser (instead of outputting a HTML web page), you need to know how to use lavarel + blade to output image content (that is content of MIME type "image/png" or similar types).
In PHP, the standard method to output an image is:
header("Content-type: image/png");
print($c->makeChart2(PNG));
Many "frameworks" have their own ways to output content. They may not use header to output the MIME header, and may not use print to output content. You would need to translate the above code to the output method of lavarel + blade.
Note that even if you use lavarel + blade to output the image, you still need to use HTML to insert the image into a web page.
<img src="/path/to/lavarel_page_outputting_image">
Modern browsers support inserting an image itself into a web page (instead of inserting an URL of the image) by using the data protocol. It is like:
<img src="data:image/png;base64,<?php echo base64_encode($c->makeChart2(PNG)); ?>">
Regards
Peter Kwan |