%Option Explicit%>
<%response.Buffer=true%>
<%
Dim myTextFile 'name to give to all Text Linking files
Dim myFolder 'name of main folder where pictures are in
Dim mySeparator 'special characters to separate the description
'********change these **********
myTextFile = "ContLink.txt"
myFolder = "images"
mySeparator = "#####"
'*******************************
Dim objFSO 'instance of FileSystemObject component
Dim objPicturesFolder 'to access the main picture folder
Dim collPicturesFolders 'collection of folders under pictures folder
Dim indPicturesFolder 'a folder in the folders collection
Dim objthisFolder 'object to hold the individual folder
Dim thisFolder 'specific folder to show from request
Dim objFile 'a file under the individual pictures folder
Dim count 'to count all the files in every folder
Dim myTextPath 'full path of the text file
Dim myFolderPath 'full path of pictures folder
Dim objNextLink 'instance of NextLink component
Dim objContLinkFile 'to access the Content Linking text file
Dim objTStream 'object to write the text stream to
Dim Index 'which picture to show?
Dim TotalItems 'total number of records in content text file
Dim NumSeconds 'seconds to wait before switching pictures
Dim strToWrite 'string to write to text file
Dim intLoop 'to help in the loop
Dim picURL 'URL of the picture in text linking file
Dim picWholeDescription 'Title and Desciption of picture separated by the Separator
Dim picTitle 'Title of picture: left of separator
Dim picDescription 'Description of picture: right of separator
Dim picPositionSeparator 'where is the mySeparator located in the picWholeDescription
%>
<%
myFolderPath = Server.MapPath(myFolder)
Function FileSize(intFileSize)
const DecimalPlaces = 1
const FileSizeBytes = 1
const FileSizeKiloByte = 1024
const FileSizeMegaByte = 1048576
const FileSizeGigaByte = 1073741824
const FileSizeTeraByte = 1099511627776
Dim strFileSize, newFilesize
If (Int(intFileSize / FileSizeTeraByte) <> 0) Then
newFilesize = Round(intFileSize / FileSizeTeraByte, DecimalPlaces)
strFileSize = newFilesize & " TB"
ElseIf (Int(intFileSize / FileSizeGigaByte) <> 0) Then
newFilesize = Round(intFileSize / FileSizeGigaByte, DecimalPlaces)
strFileSize = newFilesize & " GB"
ElseIf (Int(intFileSize / FileSizeMegaByte) <> 0) Then
newFilesize = Round(intFileSize / FileSizeMegaByte, DecimalPlaces)
strFileSize = newFilesize & " MB"
ElseIf (Int(intFileSize / FileSizeKiloByte) <> 0) Then
newFilesize = Round(intFileSize / FileSizeKiloByte, DecimalPlaces)
strFileSize = newFilesize & " KB"
ElseIf (Int(intFileSize / FileSizeBytes) <> 0) Then
newFilesize = intFilesize
strFileSize = newFilesize & " Bytes"
ElseIf Int(intFileSize) = 0 Then
strFilesize = 0 & " Bytes"
End If
FileSize = strFileSize
End Function
%>
My Pictures Contents
| Folder Name |
Size |
Number |
Slide Show |
<%
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(myFolderPath) Then
'The main picture folder exists'
Set objPicturesFolder = objFSO.GetFolder(myFolderPath)
Set collPicturesFolders = objPicturesFolder.SubFolders
For Each indPicturesFolder in collPicturesFolders
'check for text content linking file'
'if none present then create one'
myTextPath = Server.MapPath(myFolder & "\" & indPicturesFolder.Name & "\" & myTextFile)
If objFSO.FileExists(myTextPath) = False Then
'first reset string to write'
strToWrite = ""
For Each objFile in indPicturesFolder.Files
strToWrite = strToWrite & objFile.Name & vbtab & objFSO.GetBaseName(objFile.Name) & vbcrlf
Next
'write to file...'
Set objTStream = objFSO.OpenTextFile(myTextPath, 2, True, 0)
objTStream.Write(strToWrite)
'Clean up...'
Set objTStream = Nothing
Response.Flush
End If
Response.Write("" _
& "| " & indPicturesFolder.Name & " | " _
& "" & FileSize(indPicturesFolder.Size) & " | ")
Response.Write("")
count = 0
For Each objFile in indPicturesFolder.Files
If objFile.Name <> myTextFile Then
count = count + 1
End If
Next
Response.Write(count & " | ")
%>
|
<%
'Response.Write("Add Title/Description |
")'
Next
%>
<%
Set collPicturesFolders = Nothing
Else
'The main pictures folder does not exist'
Response.Write("
""picture"" folder was not found.
" _
& "Please create one first and fill it up with your pictures!")
Response.End
End If
Set objFSO = Nothing
Response.Flush
%>