我抄了下面一段代码,但是不能显示图片。还请前辈们帮忙看看
环境:
PHP 5.2.17
IE 8
windows server 2003-----------------代码如下----------------
$fileres = file_get_contents("c:/bu.JPG");
header("Content-type: image/jpeg");
echo $fileres; bu.jpg是存在的。注释掉header,也可以显示文件内容的字符串。
但是就是显示红叉,没有图片。不知道哪儿的问题,还望赐教!谢谢。
环境:
PHP 5.2.17
IE 8
windows server 2003-----------------代码如下----------------
$fileres = file_get_contents("c:/bu.JPG");
header("Content-type: image/jpeg");
echo $fileres; bu.jpg是存在的。注释掉header,也可以显示文件内容的字符串。
但是就是显示红叉,没有图片。不知道哪儿的问题,还望赐教!谢谢。
我觉得读取没有问题,就是不知道哪里设置不对,没有显示出来
$fileres = file_get_contents('c:/bu.JPG');
$im = imagecreatefromstring($fileres);
imagepng($im,"c:/ab1.jpg");//生成png图片
每天一万米要你将文件另存为无BOM的utf-8编码格式.
ob_start();$fileres = file_get_contents("c:/bu.JPG");
header("Content-type: image/jpeg");
echo $fileres; ob_end_flush();
我昨天在家里测试,不显示。但是今天在公司的机器上测试,相同的代码,就能显示了。
PHP,apache,是一样的。代码都是用netbeans写的。
难道是ie或是别的什么设置不正确?
//都说了,遇到问题,先开启错误报告,看看有没有错误 error_reporting(E_ALL);