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. Use just like getpics.php, replacing this line in PHP Album script:
with this:HTML Code:<script src="http://www.mysite.com/gallery/getpics.php" type="text/javascript"></script>
4) URL TO CODE:HTML Code:<script src="http://www.mysite.com/gallery/getpics.asp" type="text/javascript"></script>
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!
Code:<% ' 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 %>



Reply With Quote


Bookmarks