[英]imagecreatefromstring using image with data:image/png;base64,
我将图像存储为以以下内容开头的字符串:
data:image/png;base64,
我需要将其转换为普通图像以用于GD。
我尝试了imagecreatefromstring()
但它似乎只接受没有data:image/etc
pefix。
我能怎么做?
$exploded = explode(',', $data, 2); // limit to 2 parts, i.e: find the first comma
$encoded = $exploded[1]; // pick up the 2nd part
$decoded = base64_decode($encoded);
$img_handler = imagecreatefromstring($decoded);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.