我很难与php头,我试图在我的浏览器中创建任何形式的图像,而不保存在一个文件中,但不管我做什么,我可以让它工作。php头,内容类型PNG不工作
因此,举例来说,如果我用这个基本的例子,从PHP手册:
$im = imagecreate(100, 100);
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
这将设置正确的头,甚至输出图标,当找不到图像u得到。
而且我用xampp
它启用了GD,这里是我的phpinfo
GD部分:
GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.4.3
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
libJPEG Version 6b
PNG Support enabled
libPNG Version 1.2.46
WBMP Support enabled
XBM Support enabled
是我的代码是错误的或者我需要配置什么?
仍然无法正常工作,我试着用firefox来看它,这就是我得到的结果:'图像“http:// localhost/test /”无法显示,因为它包含错误。 – Linas 2012-02-29 14:36:22
双重检查它。 : - 尝试更新的代码(在die失败的情况下用'die'来初始化图像)以确保GD工作正常。 – 2012-02-29 14:50:25
问题是我在<?php标记之前有空的空间,这弄乱了我的图像:)反正thatnks的帮助 – Linas 2012-02-29 14:57:04