开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜