其中db_mysql.inc.php,config.php,function.php不是真正使用到的,关键是$filename 文件名,我是通过读取数据库中的图片名称 <?php global $picPath; if (strstr($_SERVER[HTTP_USER_AGENT],"MSIE")) { $image = getInfo(newssp_gallery,id,$_GET[id]); $filename = $picPath.$image[filename]; if (!file_exists($filename)) { header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Content-disposition:".$attachment." filename=".$image[original]); $size = @filesize($filename); header("Content-Length: $size"); $fd = @fopen($filename,rb); echo $contents; 使用的时候可以把在html文件里加上 <img src=http://www.chinaz.com/Program/PHP/showpic.php?id=xxx width=50 height=50>
include_once (inc/db_mysql.inc.php);
include_once (inc/config.php);
include_once (class/function.php);
$attachment = ;
} else {
$attachment = atachment;;
}
$filename = $picPath."notexist.gif";
}
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
$contents = @fread($fd,$size);
@fclose ($fd);
?>

RSS订阅