1
$imgPath = """BASE64 ENCODED STRING HERE""";

header('Content-Type: image/png');
$img = str_replace('data:image/png;base64,', '', $imgPath);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
$file = "test.png";
$success = file_put_contents($file, $data);

$html = '<img src="'.$file.'" />';
exit;

这里在 ff/chrome 中创建的 test.png 很好......但是 IE 很糟糕并生成损坏的图像。

4

0 回答 0