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><? <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<imgtype_count;i++){ <BR>if(type==imgtype[i]){echo"<a href="http://www.phpchina.com/.path."/".file." target=\"_blank\" alt=\"点击打开新窗口浏览\"><img src="http://www.phpchina.com/.path."/".file." border=\"0\" onload=\"if(this.height>150) {this.height=150;this.width=150*this.width/this.height;}\"></a>\n";} <BR>} <BR>} <BR>closedir(handle); <BR>/****************************************************/ <BR>?> <BR></BLOCKQUOTE>