<% Response.Buffer = True %> ASP Folder Gallery <% ' retrieve path and file info from Query String Dim strQuery,unstrQuery,arPath,imgParentPath,imageName strQuery = Request.ServerVariables("QUERY_STRING") unstrQuery = unescape(strQuery) arPath = Split(strQuery, "/") imgName = arPath(UBound(arPath,1)) imgParentPath = left(strQuery, len(strQuery)-len(imgName)) 'Gets "next" picture file name 'Previous/Next script adapted from ASP Online Photo Album at http://www.iloire.com/vbscript/online_photo_catalog_vbscript.asp Function FindTheNext (FileName) Dim File,folder,foundFile,theNextFile,fs set fs=Server.CreateObject("Scripting.FileSystemObject") fullPath = Server.MapPath(unstrQuery) strFolder = fs.GetParentFolderName(fullPath) set folder = fs.GetFolder(strFolder) foundFile=0 For each File in folder.Files If instr(1,AllowExt,fs.GetExtensionName(File.path),1)>0 then If foundFile=1 Then FindTheNext = File.Name foundFile=0 Exit Function Else If File.Name=fs.GetFileName(FileName) Then foundFile=1 End If End If End If Next FindTheNext="" set fs=nothing End Function 'Gets "previous" picture file name Function FindThePrev (FileName) Dim File,foundFile,theNextFile,folder,fs, fullPath, strFolder, imgFolder set fs=Server.CreateObject("Scripting.FileSystemObject") fullPath = Server.MapPath(unstrQuery) strFolder = fs.GetParentFolderName(fullPath) set folder = fs.GetFolder(strFolder) theNextFile="" For each File in folder.Files If instr(1,AllowExt,fs.GetExtensionName(File.path),1)>0 then If File.Name=fs.GetFileName(FileName) Then FindThePrev=theNextFile Exit Function Else theNextFile=File.Name End If End If Next FindThePrev="" set fs=nothing End Function %>
<%thePrev = FindThePrev(strQuery) If len(thePrev) Then Response.Write "" & " "%>
<%theNext=FindTheNext(strQuery) If len(theNext) Then Response.Write "" & " "%>
[ <%=imgName%> ]