查看完整版本: 图片直读代码

lily 2007-8-2 14:04

图片直读代码

             <p><DIV id=contentTxt><P>保存为index.php放在你的图片目录里面 <BLOCKQUOTE><a href="http://www.phpchina.com/javascript:;" onClick="javascript:tagshow(event, 'PHP');" target="_self"><u><strong>PHP</strong></u></a>源码: <HR><BR>&lt;? <BR>imgtype=array(bmp,jpg,jpeg,png,gif); <BR>/****************************************************/ <BR>imgtype_count=count(imgtype); <BR>path="."; <BR>handle=opendir(path); <BR>while (file = readdir(handle)){ <BR><BR>if (is_dir(file)) {continue;} <BR>type = explode(".",file); <BR>type = type[1]; <BR><BR>for(i=0;i&lt;imgtype_count;i++){ <BR>if(type==imgtype[i]){echo"&lt;a href="http://www.phpchina.com/.path."/".file." target=\"_blank\" alt=\"点击打开新窗口浏览\"&gt;&lt;img src="http://www.phpchina.com/.path."/".file." border=\"0\" onload=\"if(this.height&gt;150) {this.height=150;this.width=150*this.width/this.height;}\"&gt;&lt;/a&gt;\n";} <BR>} <BR>} <BR>closedir(handle); <BR>/****************************************************/ <BR>?&gt; <BR></BLOCKQUOTE>
页: [1]
查看完整版本: 图片直读代码
PageRank