I tried
header('Content-Type: image/png');
echo base64_decode($data);`
But it doesn't work.
I tried
header('Content-Type: image/png');
echo base64_decode($data);`
But it doesn't work.
A png data url looks like this:
data:image/png;base64,[actual data]
You have to cut the beginning to be able to base64_decode
it.
Also, if you remove the header
call, you will be able to see any error message your code outputs.
PHP has this magical function named imagecreatefromstring() too... But there is no need to use it if you need to show image only.
Thank you everyone for trying to help. The problem was I was that I forgot to url encode the query parameter before I sent it to the PHP script.