Thanks
Steve
Dynamic Image Sequencer
Use this script anywhere you may need an image rotator. Just upload your files into a directory, and the script will add them to the image rotater.
The variables at the top of the script need to be set. The GalleryFilePath variable should be the server path to the folder you are storing your images in. The GalleryURLPath should be the URL to the images folder. To work with Netscape 4.0 - 4.7, the PageX and PageY variables (below in red) need to be adjusted to fit your template. Also, the CFDIRECTORY tag has the filter set to *.gif. If you would prefer to use *.jpg, change the filter. This script can do both types at the same time if you remove the filter altogether.
gallery.cfm
<!---Set Default Vars--->
<cfset GalleryFilePath = "c:\cfusionmx\wwwroot\2004\client\images">
<cfset GalleryURLPath = "http://localhost:8500/2004/client/images">
<cfdirectory directory="#GalleryFilePath#" filter="*.gif" name="ImageList">
<html>
<head>
<script language="_javascript_">
//Detect Browser (IE or Netscape)
var bV=parseInt(navigator.appVersion);
NS4=(document.layers) ? true : false;
IE4=((document.all)&&(bV>=4))?true:false;
ver4 = (NS4 || IE4) ? true : false;
//Position index
var i = 1;
//Load all the images from the directory
function load(){
<cfoutput query="ImageList">
this[#ImageList.CurrentRow#]=new Image();
this[#ImageList.CurrentRow#].src=""> </cfoutput>
}
//create an Array to store imgage names
imgArray = new Array();
<cfoutput query="ImageList">
imgArray[#ImageList.CurrentRow#]='#GalleryURLPath##ImageList.Name#';
</cfoutput>
//Track the current image (i)
//make sure the index does not exceed the number of images
function display(pos){
if(pos == "up"){i = i + 1;}
else{i = i - 1;}
if(i == 0){i = <cfoutput>#ImageList.RecordCount#</cfoutput>;}
if(i == <cfoutput>#evaluate(ImageList.RecordCount + 1)#</cfoutput>){i = 1;}
//Display the images (DHTML)
//Netscape DHTML
if (NS4) {
content = eval("document.npic_span.document");
with (content) {
open();
write("<img src=''" + " border='2'>");
close();
}}
//IE 4.0 DHTML
else{
window.pic_span.innerHTML="<img src=''" + " border='2'>";
}}
//call the image loader (load images into ram)
if (document.images){load();}
</script>
</head>
<body>
<center>
<a name="top"></a>
<!---For netscape, adjust the PageX and PageY for the default position--->
<layer NAME="npic_span" pagex="372" pagey="155" visibility="SHOW">
<SPAN NAME="npic_span" STYLE="position: absolute;"></SPAN>
</layer>
<span id="pic_span">
<cfoutput>
<img src="" border=0>
</cfoutput>
</span>
<br>
<!---Buttons for navigatng Forwards and Backwards--->
<a href="" border="0" > <img src="" width="50" height="40" border=0>
</a>
<a href="" border="0" > <img src="" width="50" height="40" border=0>
</a>
</center>
</body>
</html>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
