Kinda a newbe to php here, but i am working on that.
I need a rotating picture at the top of a webpage. I need to do this without a db (ie mysql). I am trying to modify some code i found (props for the code-->Clicky).
What i would like to do, is count the number of files in a dir and the load an array with the file names (ie $image[1]=$file_name_one_blah, $image[2]=$file_name_two_blah), pick a rand num, and display the random pic. Sounds easy right? Its killin me.
Could somebody poke me in the right direction?? Plz!!!
I need a rotating picture at the top of a webpage. I need to do this without a db (ie mysql). I am trying to modify some code i found (props for the code-->Clicky).
Code:
srand((float) microtime() * 10000000);
$image[1]='/location/of/image1.jpg';
$image[2]='/location/of/image2.jpg';
$image[3]='/location/of/image3.jpg';
$image[4]='/location/of/image4.jpg';
$image[5]='/location/of/image5.jpg';
$rn = array_rand($image);
echo '<img src="'.$image[$rn].'">';
What i would like to do, is count the number of files in a dir and the load an array with the file names (ie $image[1]=$file_name_one_blah, $image[2]=$file_name_two_blah), pick a rand num, and display the random pic. Sounds easy right? Its killin me.
Could somebody poke me in the right direction?? Plz!!!