<% 'Declare all variables up front. dim fs, folder, file, item, url, blnPastFirst, strFirstImage 'Set get a folder object for the IMAGES directory. set fs = CreateObject("Scripting.FileSystemObject") set folder = fs.GetFolder(Server.MapPath("./images")) 'Parse list of files, just to get the first full-sized JPG (which gets displayed at the beginning. 'Should probably stop running through the files once the first JPG is found. blnPastFirst = False for each item in folder.Files 'Get only JPGs. If (Right(item.Name, 4) = ".jpg" OR Right(item.Name, 4) = ".JPG") Then strFirstImage = item.Name blnPastFirst = True Exit For End If next %> Photo Viewer

Click photo to view next image or select thumbnail below.
<% 'Now display the thumbnails. Note that we are using filenames from the images directory, 'and assuming the thumbnails directory has the exact same filenames. for each item in folder.Files If (Right(item.Name, 4) = ".jpg" OR Right(item.Name, 4) = ".JPG") Then %> <% End If next %>