Advertisement
6_2008-2009 Graphics/ Sound #199966

Image Directory Listing

Lists thumbnail images within the current directory. Very simple beginner stuff dealing with file scripting object. Handy for viewing your images quickly. Just copy the code and paste it a file called default.asp. Then view the directory on your website.

AI

Podsumowanie AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Kod źródłowy
original-source
<H1>Image Directory Listing</H1>
<%
Dim FSO
Dim Files
Dim File
Dim Count
Const Columns = 3
Const ImageWidth = 100
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set Files = FSO.GetFolder(Server.MapPath("./")).Files
Set FSO = Nothing
Response.Write "<TABLE width=""100%"" border=""1"" cellspacing=""0"">"
Response.Write "<TR>"
Count = 0
For Each File In Files
	Select Case LCase(Right(File.Name, 3))
		Case "jpg", "gif", "bmp", "png"
			Count = Count + 1
			If Count Mod Columns = 1 Then Response.Write "</TR><TR>"
			
			Response.Write "<TD align=""center"" valign=""top"">"
			
			Response.Write "<A href=""" & File.Name & """>"
			Response.Write File.Name
			Response.Write "<BR><IMG src=""" & File.Name & """ border=""1"" width=""" & ImageWidth & """><BR>"
			Response.Write "</A>"
			
			Response.Write "</TD>"
	End Select
Next
Response.Write "</TR>"
Response.Write "</TABLE>"
Set File = Nothing
Set Files = Nothing
%>
Oryginalne komentarze (3)
Odzyskane z Wayback Machine