我使用以下编码显示我上传图片的最新相册中的六张图片。然而,显示的图像是文件夹中的第一个六个图像(这是最早上传的图像)而不是最后的六个图像上载。 任何人都可以帮助我,我应该在下面的代码中更改,以显示文件夹中的最后六个图像。
<%
latestfolder = "na"
latestdate = cdate("01/01/09")
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder(Server.MapPath("images/gallery"))
for each folder in fo.subfolders
if cdate(folder.DateLastModified) > latestdate then
latestdate = cdate(folder.DateLastModified)
latestfolder = folder.name
end if
next
if latestfolder <> "na" then
set fi=fs.GetFolder(Server.MapPath("images/gallery/" & latestfolder))
looptimes = 0
for each file in fi.files
if right(lcase(file.Name),3) = "jpg" then %>
<a href="thumbnail.aspx?picture=<%=server.URLEncode("images/gallery/" & latestfolder & "/" & file.Name)%>&maxWidth=640&maxHeight=480" target="_blank" style="text-decoration:none; cursor:pointer;">
<img src="thumbnail.aspx?picture=<%=server.URLEncode("images/gallery/" & latestfolder & "/" & file.Name)%>&maxWidth=100&maxHeight=60" style="border:1px solid #ffffff; margin:5px; margin-top:14px;"> </a>
<% end if
looptimes = looptimes + 1
if looptimes = 6 then exit for end if
next
end if
%>
答案 0 :(得分:0)
呸!据说......看起来你是根据日期排序你的文件夹,而不是你的文件。