IE通过base64图像的file_put_contents生成损坏的图像

时间:2013-01-25 13:52:43

标签: php internet-explorer image-processing corrupt

$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;

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

0 个答案:

没有答案