If your page's extension is .asp and the server is enabled for asp, you should be able to replace:
Code:
var fadeimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]=["photo1.jpg", "", ""]
fadeimages[1]=["photo2.jpg", "", ""]
with (which could also be used as an external file* - comments begin with '):
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 fadeimages=new Array()
<%
'Selecting only images
Set RegExObj = New RegExp
With RegExObj
.Pattern = "gif|jpg|png"
.IgnoreCase = True
End With
For Each objItem In objFolder.Files
If RegExObj.Test(Right(objItem.Name, 3)) Then
'Add each one to the array using javascript
%>
fadeimages[counter]=["<%= objItem.Name %>", "", ""]
counter++
<%
End If
Next 'objItem
' All done! Kill off our asp object variables.
Set objItem = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
Set RegExObj = Nothing
%>
It will grab all .jpg, .gif, and .png from the current folder. For a sub-folder, see the red highlighted part. Like for a folder off of the one that this page is in named images:
strPath = "./images/"
You would also need to add that path here:
fadeimages[counter]=["images/<%= objItem.Name %>", "", ""]
I've used similar code successfully. However, I don't know a great deal about asp, there could be a better way. The above is modeled loosely on and converted to asp from the 'getpics.php' used with this script:
http://www.dynamicdrive.com/dynamici...photoalbum.htm
*To use as an external file, you could just put it, without modifying the first path (the second one would still need to be modified), in the directory with the images, save it as getpics.asp. Then on your page with the slide show script, which could now be .htm or whatever, put this tag before the main slide show script on the page:
Code:
<script type="text/javascript" src="path/getpics.asp"></script>
Where path/ is the absolute or relative path to the folder with the images and this getpics.asp file in it.
And be sure to remove this:
Code:
var fadeimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]=["photo1.jpg", "", ""]
fadeimages[1]=["photo2.jpg", "", ""]
from the main slide show script.
Bookmarks