1

我的文本在浏览器中呈现时包裹得很好: 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);
4

1 回答 1

1

所以做了一些调查,你正在使用路径

http://www.morriescontests.com/billboardImage.php?caption=LONG%20STRING%20WRAP%20TEST,%20HMMMM%20I%20WONDER%20WHAT%20WILL%20HAPPEN%20NOW?&first_name=Andrew&last_initial=S.&city=Red%20Bank&user_id =32&id=128

生成图像,但您正在查看的图像是 32-142.png

所以我将网址更改为

http://www.morriescontests.com/billboardImage.php?caption=LONG%20STRING%20WRAP%20TEST,%20HMMMM%20I%20WONDER%20WHAT%20WILL%20HAPPEN%20NOW?&first_name=Andrew&last_initial=S.&city=Red%20Bank&user_id =32&id=142

注意 id=142 现在可以正常工作了。所以看起来你看到的 32-142.png 图像是以前创建的:)

于 2012-08-24T18:55:51.017 回答