从文件夹读取图片并按时间排序,然后分页显示

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
fpath="pic/"
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
set objfolder=objFSO.getfolder(server.mappath(fpath))
picArr=""
picbegin=""
pageSize=20
page=request("page")
If page="" Then page=1
picbegin=(page-1)*pageSize
for each objfile in objfolder.files 
    If picArr="" then
        picArr=objfile.name&"$"&objfile.DateLastModified
    Else
        picArr=picArr&"|"&objfile.name&"$"&objfile.DateLastModified
    End If
next 
set objfolder=nothing 
picArr=Split(picArr,"|")
picnum=UBound(picArr)+1

Dim short
for i=0 To UBound(picArr)
    For m=i To UBound(picArr)
        If CDate(Split(picArr(i),"$")(1))<CDate(Split(picArr(m),"$")(1)) Then 
            short=picArr(i)
            picArr(i)=picArr(m)
            picArr(m)=short
        End if
    next
next

If picnum<pageSize Then
    pageCount=1
Else
    pageCount=Int(picnum/pageSize)
    If picnum Mod pageSize >0 Then pageCount=pageCount+1
End If
thispageend=picbegin+pageSize -1
If thispageend>=picnum Then thispageend=picnum-1
img_html = ""
For i=picbegin To thispageend
    img_html = img_html + "<li><a href='pic/"&Split(picArr(i),"$")(0)&"' target=_blank><img src='pic/"&Split(picArr(i),"$")(0)&"' /></a><br><span class=title>"&Split(Split(picArr(i),"$")(0),".")(0)&"</span><br><span class=date>"&Split(picArr(i),"$")(1)&"</span></li>"
Next
page_html = "当前:第<font color=red><b>"&page&"</b></font>页&nbsp;&nbsp;第"
For i=1 To pageCount
page_html = page_html + "&nbsp<a href='?page="&i&"'>"&i&"</a>&nbsp;"
Next
page_html = page_html + "页&nbsp;&nbsp;共计<font color=red><b>"&pageCount&"</b></font>页"
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Img</title>
<style>
body,td,th {
	/*文字大小*/
	font-size: 16px;
	/*文字颜色*/
	color: #2E2E2E;
	/*文字行距*/
	line-height: 20px;
}
a:link {
	text-decoration: none;
	color: #000000;
}

a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	color: #FF6600;
}
ul {margin:0; padding:0; list-style:none;}
li {float:left; width:180px; overflow:hidden; text-align:center; margin:10px 6px 6px 6px}
.title{ line-height:28px}
.date {color:#666}
li img{border:#999 1px solid; width:178px; height:133px; }
div.page {padding:0 6px}
div.page a{ border:1px #F90 solid; padding:0 2px}
</style>
</head>

<body>

			<ul><%=img_html%></ul>
            <div style="clear: both; text-align:center; padding:0 20px"><hr /></div>
            <div class="page"><%=page_html%></div>

</body>
</html>