% On Error Resume Next 'Randomize Timer strPath = Request.QueryString("path") image = Request.Querystring("image") Const strValid = ".jpg" count=0 ' make sure we have a trailing slash in the path If Right(strPath,1) <> Chr(47) Then strPath = strPath & Chr(47) ' get the physical path of the folder strPhysical = Server.MapPath(strPath) ' get a File System Object Set objFSO = Server.CreateObject("Scripting.FileSystemObject") ' create a folder object Set objFolder = objFSO.GetFolder(strPhysical) ' get the files collection Set objFiles = objFolder.Files ' enumerate the files collection looking for images For Each objFile in objFiles strFile = LCase(objFile.Name) If Instr(strValid,Right(strFile,4)) Then ' add vaild images to a string of image names strFiles = strFiles & strFile & vbTab count=count+1 End If Next ' split the image names into an array strImages = Split(strFiles,vbTab) If image="" then if UBound(strImages) > 1 then imagedisplayed=strPath & strImages(0) if UBound(strImages) > 1 then imagedisplayednext=strImages(1) else imagedisplayed=strPath&image call singlesorter(strImages) For iLoop = LBound(strImages) to UBound(strImages) If CStr(image) = CStr(strImages(iLoop)) then 'We found the element where = iLoop End If Next if where=count then imagedisplayednext=strImages(0) else imagedisplayednext=strImages(where+1) end if end if If Request.QueryString("method")="html" then %> <% SlideShowLink=request.servervariables("script_name")&"?path="&strpath&"&image="&imagedisplayednext&"&method="&request.querystring("method") Response.Write "" & vbcrlf Response.Write "
" Response.Write "" %> <% else Response.Redirect imagedisplayed end if%>