<% @Language = "VBscript" %> <% '==================================================================== 'Copyright (C) 2004 VirtualFlair.com '==================================================================== 'The script is licensed as follows: 'You may copy, display and modify the script as long as all copyright 'notices and comments by the original author remains intact. 'You may distribute the script in the original unaltered version only 'for non-commercial use and without profiting by it. 'If you wish to distribute an altered version of the script for 'non-commercial or commercial use you are obligated to contact the 'original author of the script and get his/hers consent. '==================================================================== %> <% Public Sub printGallery() Call initiateGallery() Call printImages() Call printPaging() End Sub Dim intTotalItems, intCurrentPage, intStartItem, arrItems Sub initiateGallery() '==========paging========== intCurrentPage = Request.QueryString("page") If intCurrentPage = "" Or Int(intCurrentPage) = 0 Then intCurrentPage = 1 End If intStartItem = (((intCurrentPage - 1) * itemsPerPage) + 1) If Int(intStartItem) = 0 Then intStartItem = 1 End If '==========get images========== '==> Dim objFso, objFolderFiles Set objFso = Server.CreateObject("Scripting.FileSystemObject") Set objFolderFiles = objFso.GetFolder(Server.MapPath(imageDirectory)) allowedImageTypes = Split(allowedImageTypes, ",") Dim objItem, i, bolFileExtensionAllowed For Each objItem In objFolderFiles.files bolFileExtensionAllowed = 0 '==========check if file extension is allowed========== For i = 0 To UBound(allowedImageTypes) If LCase(objFso.GetExtensionName(objItem)) = LCase(Trim(allowedImageTypes(i))) Then bolFileExtensionAllowed = 1 Exit For End If Next '==========add image to "arrItems"========== If bolFileExtensionAllowed = 1 Then intTotalItems = (intTotalItems + 1) If Int(intStartItem) <= Int(intTotalItems) And Int(intTotalItems) < Int(intStartItem + itemsPerPage) Then If arrItems = "" Then arrItems = arrItems & objItem.Name Else arrItems = arrItems & "," & objItem.Name End If End If End If Next Set objFolderFiles = Nothing Set objFso = Nothing '<== End Sub Sub printImages() arrItems = split(arrItems, ",") Response.Write ("") & vbNewline Dim i, itemPrints For i = 0 To UBound(arrItems) itemPrints = itemPrints + 1 If Int(itemPrints) = 1 Then Response.Write ("") & vbNewline End If Response.Write ("" & vbNewline If Int(itemPrints) = Int(itemsPerRow) Or i = UBound(arrItems) Then itemPrints = 0 Response.Write ("") & vbNewline End If Next Response.Write ("
") &_ "" &_ "
") & vbNewline End Sub Sub printPaging() Dim intTotalPages intTotalItems = intTotalItems intTotalPages = (intTotalItems / itemsPerPage) If Int(intTotalPages) < intTotalPages Then intTotalPages = Int(intTotalPages + 1) End If Dim strPageName strPageName = Request.ServerVariables("script_name") '==========print paging========== If 1 < intTotalPages Then Response.Write ("
") &_ "Sayfa: " Dim i For i = 1 To intTotalPages If Int(intCurrentPage) =Int(i) Then Response.Write (" ("& i &")") Else Response.Write (" " & i & "") End If If Not i = intTotalPages Then Response.Write (", ") End If Next Response.Write ("
") End If End Sub %>
<% = pageTitle %>

<% Call printGallery() %>