PHP: base64 image string to image reference
How do I take an base64 string image and covert it to a image reference. The base64 string is sent via ajax. I'm not sure if image reference is the correct terminology so I'll provide an example.
#original method
$newImg = imagecreatefromjpeg($oImg);
#n开发者_C百科ew method
$newImg = imagecreatefromjpeg($base64String); //THIS IS NOT CORRECT
$data = base64_decode($base64String);
$image = imagecreatefromstring($data);
In this example, imagecreatefromstring()
doesn't refer to an actual string of letters in the PHP sense, but rather a blob of data/bytes.
精彩评论