Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我将图像存储为以以下开头的字符串:
data:image/png;base64,
我需要将其转换为普通图像以便与 GD 一起使用。
我试过imagecreatefromstring()了,但它似乎只接受没有data:image/etc前缀的图像。
imagecreatefromstring()
data:image/etc
我能怎么做?
$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);