我有一大串base64图像数据(大约200K)。当我尝试通过输出具有正确标题的解码数据来转换该数据时,脚本死亡,好像内存不足。我的Apache日志中没有错误。下面的示例代码适用于小图片。如何解码大图像?如何将大量的base64图像数据转换回带有PHP的图像?
<?php
// function to display the image
function display_img($imgcode,$type) {
header('Content-type: image/'.$type);
header('Content-length: '.strlen($imgcode));
echo base64_decode($imgcode);
}
$imgcode = file_get_contents("image.txt");
// show the image directly
display_img($imgcode,'jpg');
?>
这是很好的知道,但是,你是对的,它不能解决问题。 – zvineyard 2011-03-22 14:55:39