php 隐藏图片难题!!!

来源:百度知道 编辑:UC知道 时间:2024/06/23 14:45:22
php5中我想读取一张图片并输出到浏览器,代码如下:
<?
$image_path="program/image";
$image_file="program/image/ml.jpg";
$sTmpVar = fread(fopen($image_file, 'r'), filesize($image_file));
header("Content-type: image/*");
echo $sTmpVar ;
flush() ;
?>
结果是输出的是乱码,不是图片,网上找了好就没有答案,向大家求救,谢谢!
感谢 "又把名字忘了"的回答,这样是可以显示图片,但是图片地址没有隐藏!
难道没有大侠知道?!

<img src="a.php"> 存为b.htm

<?php
$file = "https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/logo-zhidao.gif";
$pic = file_get_contents($file);
header("Content-type: image/*");
echo $pic;
?>
存为a.php
然后访问b.htm

echo "<img src='".$image_file."' border='0'>";