You need to remove the part that says data:image/png;base64,
at the beginning of the image data. The actual base64 data comes after that.
Just strip everything up to and including base64,
(before calling base64_decode()
on the data) and you'll be fine.