我的文本在浏览器中呈现时包裹得很好: http ://www.morriescontests.com/index.php/view/page/image
但是,当相同的代码只是创建并保存一个新文件时,它不会: http ://www.morriescontests.com/images/uploads/32-142.png
这显然让我非常难过:(
它们是单独的脚本,一个用于测试。没有正确包装的脚本只有一个区别,没有发送标题(obvi)。我正在使用 imgpng($image, $filename) 函数。
两个脚本都在同一台服务器上,这是最后一行代码:
// create image
header("Content-type: image/png"); // this is omitted from the incorrect wrapping script
// send to browser
imagepng($img); // this is omitted from the incorrect wrapping script
// save to file
$filepath = "the/path/image.png";
imagepng($img, $filepath);
imagedestroy($img);