Hi.
I'm currently trying to output an image (chart generated with PHP). After I get all the data I need I just output the image to disk with:
imagepng($img, "img/graf.png", 0);
imagedestroy($img);
Then I call the image on the page, but the browser uses always the cached image instead of the newly generated image. So I am trying to output the image to browser.
Main page is k_b.php. The graph is generated, when I call the file grafico.php with an
include 'grafico.php';
present in k_b.php file. Then I have some code that shows diferent buttons/text depending on other factors, but I must show that chart.
When I try to output the chart directly to the browser I just shows the chart and nothing else. with imagepng($img);
EDIT: Found this online and it seems to work;
ob_start();
imagepng($img);
$contents = ob_get_contents();
ob_end_clean();
$imagem = "<img src='data:image/png;base64,".base64_encode($contents)."' />";
imagedestroy($img);