<%@LANGUAGE="VBSCRIPT"%> Fine Art & New England Scenic Images photo blog
CaptainFletch.com Logo
 Homepage . Artwork . Design Services . Sailing . Sitemap ..
Home > Artwork > Photography > Photo Blog Index > <%= month(date())&"/"&year(date())%> <% 'getdetailimage 'dim filename 'filename = Request.QueryString("name") %> <% ' In this demo, at least, we don't allow user to change directories... ' Change the DIRECTORY to point to any virtual directory of your choice. CONST DIRECTORY = "/" ' relative path in virtual directories ' Specify one of these constants for "sortBy"... CONST FILE_NAME = 0 CONST FILE_EXT = 1 CONST FILE_TYPE = 2 CONST FILE_SIZE = 3 CONST FILE_CREATED = 4 CONST FILE_MODIFIED = 5 '********** 'kc_fsoFiles 'Purpose: ' 1. To create a recordset using the FSO object and ADODB ' 2. Allows you to exclude files from the recordset if needed 'Use: ' 1. Call the function when you're ready to open the recordset ' and output it onto the page. ' example: ' Dim rsFSO, strPath ' strPath = Server.MapPath("\PlayGround\FSO\Stuff\") ' Set rsFSO = kc_fsoFiles(strPath, "_") ' The "_" will exclude all files beginning with ' an underscore '********** Function kc_fsoFiles(theFolder, Exclude) Dim rsFSO, objFSO, objFolder, File Const adInteger = 3 Const adDate = 7 Const adVarChar = 200 'create an ADODB.Recordset and call it rsFSO Set rsFSO = Server.CreateObject("ADODB.Recordset") 'Open the FSO object Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 'go get the folder to output it's contents Set objFolder = objFSO.GetFolder(theFolder) 'Now get rid of the objFSO since we're done with it. Set objFSO = Nothing 'create the various rows of the recordset With rsFSO.Fields .Append "Name", adVarChar, 200 .Append "Type", adVarChar, 200 .Append "DateCreated", adDate .Append "DateLastAccessed", adDate .Append "DateLastModified", adDate .Append "Size", adInteger .Append "TotalFileCount", adInteger End With rsFSO.Open() 'Now let's find all the files in the folder For Each File In objFolder.Files 'hide any file that begins with the character to exclude If (right(File.Name, 3)) <> "asp" Then rsFSO.AddNew rsFSO("Name") = File.Name rsFSO("Type") = File.Type rsFSO("DateCreated") = File.DateCreated rsFSO("DateLastAccessed") = File.DateLastAccessed rsFSO("DateLastModified") = File.DateLastModified rsFSO("Size") = File.Size rsFSO.Update End If Next 'And finally, let's declare how we want the files 'sorted on the page. In this example, we are sorting 'by File Type in descending order, 'then by Name in an ascending order. rsFSO.Sort = "DateCreated DESC, DateLastModified DESC " 'Now get out of the objFolder since we're done with it. Set objFolder = Nothing 'now make sure we are at the beginning of the recordset 'not necessarily needed, but let's do it just to be sure. rsFSO.MoveFirst() Set kc_fsoFiles = rsFSO End Function 'Now let's call the function and open the recordset on the page 'the folder we will be displaying Dim strFolder : strFolder = Server.MapPath("\artwork\photography\blog\") 'the actual recordset we will be creating with the kc_fsoFiles function Dim rsFSO 'now let's call the function and open the recordset 'we will exclude all files beginning with a "_" Set rsFSO = kc_fsoFiles(strFolder, "_") 'now we'll create a loop and start displaying the folder 'contents with our recordset. Of course, this is just a 'simple example and not very well formatted, i.e., not in 'a table, but it gets the point across on how you can 'ouput the recordset on the page. ' While not rsFSO.eOF dim photodate photodate=rsFSO("DateLastModified") %> <% Dim arrHeaders(35) Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.Namespace("D:\SWsoft\PEM\CustomerData\webspaces\webspace_00052323\wwwroot\artwork\photography\blog\") For i = 10 to 14 arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i) Next For Each strFileName in objFolder.Items 'dim compstring 'compstring ="blogtest"+left(rsFSO("Name").Value,8) 'response.write(strFileName) dim filenamevar if right(strFileName,8) = left(rsFSO("Name").Value,8) then 'For i = 10 to 14 dim photowidth photowidth = objFolder.GetDetailsOf(strFileName, 26) dim orientationwidth dim orientationhieght if left(photowidth,3) > right(photowidth,3) then orientationwidth = 640 else orientationwidth = 480 if left(photowidth,3) < right(photowidth,3) then orientationhieght = 640 else orientationhieght = 480 'end if 'next %>

" class="imageborder" width="<%=orientationwidth%>" height="<%=orientationhieght%>">

<%= left(photodate, 10)%> - <% response.write(objFolder.GetDetailsOf(strFileName, 10)) response.write("
") response.write(objFolder.GetDetailsOf(strFileName, 14)) 'Next End if Next %> <% 'and let's move to the next record 'rsFso.MoveNext() 'Wend 'finally, close out the recordset rsFSO.close() Set rsFSO = Nothing %>

Photoblogs.org
View My Profile

This image is copyright protected


Back to the CaptainFletch.com Homepage

<% 'rshits.Close() 'Set rshits = Nothing %>