Replies: 2 comments 2 replies
-
You mean converting the base64 URI to a PNG? In that case you need to cut off the header part and then decode the base64, which gives you the raw PNG, like so: // the URI from your database
$base64URI = 'data:image/png;base64,<base64 encoded data...>';
// explode on the comma (this is safe because there is only one occurrence)
// and take the second part of the array
$base64 = explode(',', $base64URI)[1];
// decode the image data
$rawPNG = base64_decode($base64);
// output with proper header
header('Content-Type: image/png');
echo $rawPNG; See also: |
Beta Was this translation helpful? Give feedback.
0 replies
-
actually the header starts with svg |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
hello im storing base64 formats to db. Now i need to download QR as png. is it possible to convert base64 code to png ?
Beta Was this translation helpful? Give feedback.
All reactions