%@ Language=VBScript %> <% On Error Resume Next dim Imager set Imager = Server.CreateObject("persits.Jpeg") dim FSO, path path = server.MapPath("\gallery") Set FSO = Server.CreateObject("Scripting.FileSystemObject") Dim GalleryFolder Set GalleryFolder = FSO.GetFolder( path ) Dim GalleryFiles Set GalleryFiles = GalleryFolder.files Dim imgArray() ReDim imgArray ( 500 ) dim CurrentSlot, fName, fExt, fType, fSize, fCreate, fMod, fAccess CurrentSlot = -1 For Each fileItem in GalleryFiles fName = fileItem.Name fExt = InStrRev(fName, ".") If fExt < 1 Then fExt = "" Else fExt = Mid(fName,Fext+1) End If 'fType = fileItem.Type 'fSize = fileItem.Size 'fCreate = FormatDateTime(fileItem.DateCreated, vbShortDate) 'fMod = FormatDateTime(fileItem.DateLastModified, vbShortDate) 'fAccess = FormatDateTime(fileItem.DateLastAccessed, vbShortDate) CurrentSlot = CurrentSlot + 1 'imgArray(CurrentSlot) = Array(fName, fExt, fType, fSize, fCreate, fMod, fAccess) imgArray(CurrentSlot) = Array(fName, fExt) Next Dim fileCount fileCount = CurrentSlot ReDim Preserve imgArray(CurrentSlot) 'now get which page the user is on dim CurrentPage CurrentPage = request("CurrentPage") if CurrentPage = "" Then CurrentPage = 1 dim ImgsPerPage ImgsPerPage = 8 Dim TotalPages, TotalFiles TotalFiles = UBound(imgArray)+1 if(TotalFiles mod ImgsPerPage = 0) then TotalPages = Cint(TotalFiles/ImgsPerPage) Else TotalPages = Int((TotalFiles/ImgsPerPage)+1) End If Dim StartingImg StartingImg = (CurrentPage*ImgsPerPage)-ImgsPerPage Dim EndingImg EndingImg = (CurrentPage*ImgsPerPage)-1 Dim intFetch, intTempPage Dim strLinks strLinks = strLinks & "<" & VBCRLF If currentPage > 20 Then strLinks = strLinks & "<" & VBCRLF End If If currentPage <= 20 Then intTempPage = 1 If TotalPages < 20 Then intFetch = TotalPages Else intFetch = 20 End If End If If currentPage > 20 Then intFetch = currentPage + 19 If intFetch > TotalPages Then intFetch = TotalPages intTempPage = currentPage If currentPage > TotalPages - 20 Then intTempPage = TotalPages - 19 If TotalPages < 1 Then TotalPages = 1 End If For x = intTempPage to intFetch strLinks = strLinks & "" & x & "" & VBCRLF Next If currentPage <= TotalPages - 20 Then strLinks = strLinks & ">" & VBCRLF ElseIf currentPage > TotalPages - 20 AND currentPage <> TotalPages Then strLinks = strLinks & ">" & VBCRLF End If strLinks = strLinks & ">>" & VBCRLF %>
![]() |