您现在的位置: 设计龙 >> 网络编程 >> php教程 >> 正文

PHP图片直读代码

Author:x Link:www Hits: Update:2006-10-2 12:52:29
天极网摘 ViVi收藏夹 365Key 和讯网摘 POCO网摘

保存为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);
/****************************************************/
?>

   
  • 上一篇文章:
  • 下一篇文章:
  • [回到标题] [回到顶部]