@Frosty: About the "rand (0, $file_count - 1)", I suppose the array indexing works just like in C ?
Let's say we have an array of 3 elements (hence $file_count = 3)
we have
array[0] -> first element
array[1] -> second element
array[2] -> third element (and no array[3], which is out of bounds)
is that right ?
so if I want to pick a random number between 0 and 2 inclusively, I call rand (0, $file_list - 1)... well that's how I see things, but you know PHP better than me so... ???
@SF: with this script you have to arrange your pics into subdirectories, because it takes the whole image list.
If you want a script that would output only a selected set of images randomly, you can write something like this:
Code:
<?php
$files = Array("image1.gif", "image2.jpeg", "image3.png"); // list of files
$file_count = 3; // number of files to choose from
// take one file randomly among the list and send it away
readfile ($files[rand (0, $file_count - 1)]);
?>