<% ' PhotoAlbum Dim CurFile, PopFileShowSub, ShowPic, PictureNo Dim strPathInfo, strPhysicalPath Dim intTotPics, intPicsPerRow, intPicsPerPage, intTotPages, intPage, strPicArray() intPicsPerRow = 5 intPicsPerPage = 20 intPage = CInt(Request.QueryString("Page")) If intPage = 0 Then intPage = 1 End If CurFile = "PhotoAlbum.asp" PopFile = "ShowPicture.asp" %>
method="POST"> Photo Album:
<% If ShowPic > " " then ShowPic = Replace(ShowPic, " ", "%20") Response.Write "

Go Back
" Else %> <% strPhysicalPath = Server.MapPath(".\" & ShowSub) If ShowSub > " " then ShowSub = Replace(ShowSub, " ", "%20") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(strPhysicalPath) Set objFolderContents = objFolder.Files 'Get the number of pictures in the subdirectory intTotPics = 0 For Each objFileItem in objFolderContents If Ucase(Right(objFileItem.Name,4))=".GIF" OR Ucase(Right(objFileItem.Name,4))=".JPG" THEN intTotPics = intTotPics + 1 End if Next 'Get the total number of pages in the subdirectory If (intTotPics/intPicsPerPage) = (int(intTotPics/intPicsPerPage)) Then intTotPages = int(intTotPics/intPicsPerPage) Else intTotPages = int(intTotPics/intPicsPerPage)+1 End If Redim strPicArray(2,intTotPics) 'Store picture file names in an array x = 0 For Each objFileItem in objFolderContents If Ucase(Right(objFileItem.Name,4))=".GIF" OR Ucase(Right(objFileItem.Name,4))=".JPG" THEN strPicArray(0,x) = objFileItem.Name strPicArray(1,x) = Cstr(int(x/intPicsPerPage)+1) x = x + 1 End if Next 'Determine if there are multiple pages and if so, display page numbers. If intTotPages > 1 Then Response.Write "" Response.Write "" End If For x = 0 to UBound(strPicArray,2)-1 If CInt(strPicArray(1,x)) = intPage Then ShowPic = Replace(strPicArray(0,x), " ", "%20") Response.write "" & vbcrlf PictureNo = PictureNo + 1 If PictureNo=intPicsPerRow Then Response.write "" PictureNo = 0 End if End If Next Set objFSO = Nothing End if %>
Page:   " For x = 1 to intTotPages If x = intPage Then Response.Write "" & x & "    " Else Response.Write "" & x & "    " End If Next Response.Write "
 
" Response.Write(" ") Response.Write("
" & Mid(strPicArray(0,x),1,Len(strPicArray(0,x))-4) & "") Response.write "
<% End if %>