Search Tools Links Login

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.

Original Author: Lewis E. Moten III

Code

Image Directory Listing


<%
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 ""
Response.Write ""
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 ""

Response.Write ""
End Select
Next
Response.Write ""
Response.Write "
"

Response.Write ""
Response.Write File.Name
Response.Write "

"
Response.Write "
"

Response.Write "
"
Set File = Nothing
Set Files = Nothing
%>

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 91 times

Categories

ASP/ HTML

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.