Here is how I do it
<!--- First check for a count in a special dir and return it as a record
count --->
<CFIF NOT IsDefined("Session.RandNum")>
<CFSET PATH = ExpandPath("images\life_care_rand")>
<CFDIRECTORY ACTION="LIST" DIRECTORY="#PATH#" NAME="rand_dir">
<CFSET Session.RandNum = RAND_DIR.RecordCount - 2>
<CFELSE>
<CFSET Session.RandImageNumber = RandRange(1, Session.RandNum)>
</CFIF>
<!--- In line in your code you just output the image name --->
SomeImageName#Session.RandImageNumber#.jpg
Each time the page is refreshed the session is renewed with a new number.
You only have to get the number in the dir once.
Hope this helps some.
Bill
> -----Original Message-----
> From: Jon Tillman [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 21, 2000 4:46 PM
> To: [EMAIL PROTECTED]
> Subject: dynamically serving images
>
>
> Okay, so I have a directory full of images that are all the same
> size, and I
> want to display them in some pseudo-random order, so that you
> don't see the
> same one every time you hit the page containing them...
>
> Heres what I have figured out:
> make a series of includes to point to each image
> <image_01.inc>
> <a href="http://www.blah.com">blah.jpg</a>
>
> Now i need to figure out how to loop through the list of available
> includes and pick one at random. Any ideas?
>
> --
> ***********************************************
> Jon Tillman
> LINUX USER: #141163
> ICQ: 4015362
> http://www.eruditum.org
> [EMAIL PROTECTED]
> ***********************************************
> Help Jon build a network!
> Looking for giveaway computers & parts
> Current Need: Tape Drive & PI/PII processors
> Email me to find out how you can help
> ***********************************************
>
> ------------------------------------------------------------------
> ------------
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf
> _talk or send a message to [EMAIL PROTECTED] with
> 'unsubscribe' in the body.
>
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.