jscheuer1
06-19-2006, 07:41 AM
1) CODE TITLE: getpics.asp
2) AUTHOR NAME/NOTES: jscheuer1, freely adapted from:
http://www.asp101.com/samples/dir_list.asp
3) DESCRIPTION: An ASP/VB/JSCRIPT hybrid that is a drop in replacement for getpics.php for servers that have asp, but not php, available. For use with PHP Album script (http://dynamicdrive.com/dynamicindex4/php-photoalbum.htm). Use just like getpics.php, replacing this line in PHP Album script:
<script src="http://www.mysite.com/gallery/getpics.php" type="text/javascript"></script>
with this:
<script src="http://www.mysite.com/gallery/getpics.asp" type="text/javascript"></script>
4) URL TO CODE:
or, ATTACHED BELOW (see #3 in guidelines below):
Simply save the below as 'getpics.asp' and upload it to your image directory just as instructed to for getpics.php.
Do not edit the file! Comments are developers notes only, not instructions for editing!
<%
' The Runtime code:
' Create some asp variables for
Dim strPath 'Path of directory
Dim objFSO 'FileSystemObject variable
Dim objFolder 'Folder variable
Dim objItem 'Variable used to loop through the contents of the folder
' You could just as easily read this from some sort of input
' NOTE: As currently implemented, this needs to end with the /
strPath = "./"
' Create our FSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
' Get a handle on our folder
Set objFolder = objFSO.GetFolder(Server.MapPath(strPath))
'Create some javascript variables
%>
var counter=0
var galleryarray=new Array()
<%
'Selecting only images
For Each objItem In objFolder.Files
If Right(objItem.Type, 5)="Image" Then
'Add each one and their date to the array using javascript
%>
galleryarray[counter]=["<%= objItem.Name %>", "<%= objItem.DateCreated %>"]
counter++
<%
End If
Next 'objItem
' All done! Kill off our asp object variables.
Set objItem = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
%>
2) AUTHOR NAME/NOTES: jscheuer1, freely adapted from:
http://www.asp101.com/samples/dir_list.asp
3) DESCRIPTION: An ASP/VB/JSCRIPT hybrid that is a drop in replacement for getpics.php for servers that have asp, but not php, available. For use with PHP Album script (http://dynamicdrive.com/dynamicindex4/php-photoalbum.htm). Use just like getpics.php, replacing this line in PHP Album script:
<script src="http://www.mysite.com/gallery/getpics.php" type="text/javascript"></script>
with this:
<script src="http://www.mysite.com/gallery/getpics.asp" type="text/javascript"></script>
4) URL TO CODE:
or, ATTACHED BELOW (see #3 in guidelines below):
Simply save the below as 'getpics.asp' and upload it to your image directory just as instructed to for getpics.php.
Do not edit the file! Comments are developers notes only, not instructions for editing!
<%
' The Runtime code:
' Create some asp variables for
Dim strPath 'Path of directory
Dim objFSO 'FileSystemObject variable
Dim objFolder 'Folder variable
Dim objItem 'Variable used to loop through the contents of the folder
' You could just as easily read this from some sort of input
' NOTE: As currently implemented, this needs to end with the /
strPath = "./"
' Create our FSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
' Get a handle on our folder
Set objFolder = objFSO.GetFolder(Server.MapPath(strPath))
'Create some javascript variables
%>
var counter=0
var galleryarray=new Array()
<%
'Selecting only images
For Each objItem In objFolder.Files
If Right(objItem.Type, 5)="Image" Then
'Add each one and their date to the array using javascript
%>
galleryarray[counter]=["<%= objItem.Name %>", "<%= objItem.DateCreated %>"]
counter++
<%
End If
Next 'objItem
' All done! Kill off our asp object variables.
Set objItem = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
%>