tags:

views:

154

answers:

3

I tried

header('Content-Type: image/png');
echo base64_decode($data);`

But it doesn't work.

A: 

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.

Maerlyn
Thank you. I am cutting the beginning, and it is still not working. :(
Drew LeSueur
What is the error message? And I don't mean the "The image cannot be..." one.
Maerlyn
A: 

PHP has this magical function named imagecreatefromstring() too... But there is no need to use it if you need to show image only.

Anpher
A: 

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.

Drew LeSueur