You can use imagecreatefromstring() function:
$data = base64_decode($_POST['image_as_base64']);$formImage = imagecreatefromstring($data);
"String" does not mean a "real" string. In that case it means bytes/blob data.
How can I create a GD resource from that again so that I actually can save that image as a file?
Are you sure you need to do that extra step? How about:
file_put_contents('MyFile.jpg', base64_decode($_POST['MyFormField']));
I did by this way:
// input is in format: data:image/png;base64,...$str="data:image/png;base64,"; $data=str_replace($str,"",$_POST['image']); $data = base64_decode($data);file_put_contents('tmp/'.mktime().'.png', $data);