I have an image that is stored as a string that starts with:
data:image/png;base64,
I need to convert it to a normal image in order to use it with GD.
I tried imagecreatefromstring() , but it seems to only accept images without data:image/etc pefix.
imagecreatefromstring()
data:image/etc
How can i do this?
$exploded = explode(',', $data, 2); // limit to 2 parts, ie: find the first comma $encoded = $exploded[1]; // pick up the 2nd part $decoded = base64_decode($encoded); $img_handler = imagecreatefromstring($decoded);