Zhlw.com - 中华龙网

站长资讯通告:
搜索: 您的位置中华龙网 > 计算机网络 > 网络编程 > PHP > 文章列表

图片直读代码

作者:bear  来源:转载  发布时间:2005-11-12 8:55:13

保存为index.php放在你的图片目录里面中国站长资讯网。


PHP源码:
--------------------------------------------------------------------------------

<?
$imgtype=array(bmp,jpg,jpeg,png,gif);
/****************************************************/
$imgtype_count=count($imgtype);
$path=".";
$handle=opendir($path);
while ($file = readdir($handle)){

if (is_dir($file)) {continue;}
$type = explode(".",$file);
$type = $type[1];

        for($i=0;$i<$imgtype_count;$i++){
if($type==$imgtype[$i]){echo"<a href=".$path."/".$file." target=\"_blank\" alt=\"点击打开新窗口浏览\"><img src=".$path."/".$file." border=\"0\" onload=\"if(this.height>150) {this.height=150;this.width=150*this.width/this.height;}\"></a>\n";}
        }
                                }
closedir($handle);
/****************************************************/
?>

        用户名: 验证码: 验证码,看不清楚?请点击刷新验证码 (注“”为必填内容。)


文章评论: [ 查看全部 ] 网友评论
关于本站 - 网站帮助 - 广告合作 - 友情连接 - 网站地图