How does pyro get the images to change automatically on his page (ryanbill)? I have viewed the code, but I still don't understand. Does it automatically scan a given folder?I actually use PHP to do this...
You could use code something like this to do it:
$headerpics = array("/images/background_1.jpg", "/images/background_2.jpg", "/images/background_3.jpg", "/images/background_4.jpg", "/images/background_5.jpg");
$rand = rand(0,count($headerpics)-1);
echo "<img src=http://www.webdeveloper.com/forum/archive/index.php/\"".$headerpics[$rand]."\" alt=\"\" />";
My code is a bit different than that, but that is the general idea. Another method, which I would imagine Ryan is using, would be to use the php opendir function, and map all jpg's in a folder to an array, then randomly select an image out of that array, this would be helpful since you wouldn't have to manually update your array when you add images. Alternately, you could give your images a common naming scheme (img_1.jpg, img_2.jpg, img_3.jpg, etc.) then just loop through checking for file existance until you find one that doesn't exist.
You could use code something like this to do it:
$headerpics = array("/images/background_1.jpg", "/images/background_2.jpg", "/images/background_3.jpg", "/images/background_4.jpg", "/images/background_5.jpg");
$rand = rand(0,count($headerpics)-1);
echo "<img src=http://www.webdeveloper.com/forum/archive/index.php/\"".$headerpics[$rand]."\" alt=\"\" />";
My code is a bit different than that, but that is the general idea. Another method, which I would imagine Ryan is using, would be to use the php opendir function, and map all jpg's in a folder to an array, then randomly select an image out of that array, this would be helpful since you wouldn't have to manually update your array when you add images. Alternately, you could give your images a common naming scheme (img_1.jpg, img_2.jpg, img_3.jpg, etc.) then just loop through checking for file existance until you find one that doesn't exist.