Wesker99
(?)Community Member
- Posted: Thu, 11 Nov 2004 20:30:38 +0000
Howdy, I just made an image rotation script that should output a random image every time you refresh it. It works fine in IE, but in firefox it works for like the first 3 refreshes, and in Mozilla it only outputs the same image every single time.
I find that if you manually put the the url of the image into you're browser, it'll work every time, but if you have it in a page, and you press refresh it does what I have stated above..
Assuming this isn't a problem with my luck, is there anything I can do to get around this?
Here's the code:
I've been looking at this for hours and I can't think of anything. Some new eyes might be able to find somthing I've overlooked. Any help would be greatly appreciated.
Thanks a lot smile
[FYI]That's the finished product in my signature.[/FYI]
I find that if you manually put the the url of the image into you're browser, it'll work every time, but if you have it in a page, and you press refresh it does what I have stated above..
Assuming this isn't a problem with my luck, is there anything I can do to get around this?
Here's the code:
<?
function ImageArray($directory) {
$handle = opendir($directory)
$imageArray = array()
/*Opens $handle*/
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
/*If the file is .png then it goes into the array*/
if(ereg(".png$",$file)) {
array_push($imageArray, $directory."/".$file)
}
}
}
closedir($handle)
sort($imageArray)
return $imageArray;
}
$images = array()
$images = ImageArray("./sigs/wesk99")
shuffle($images)
Header("Location: ".$images[0])
?>
function ImageArray($directory) {
$handle = opendir($directory)
$imageArray = array()
/*Opens $handle*/
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
/*If the file is .png then it goes into the array*/
if(ereg(".png$",$file)) {
array_push($imageArray, $directory."/".$file)
}
}
}
closedir($handle)
sort($imageArray)
return $imageArray;
}
$images = array()
$images = ImageArray("./sigs/wesk99")
shuffle($images)
Header("Location: ".$images[0])
?>
I've been looking at this for hours and I can't think of anything. Some new eyes might be able to find somthing I've overlooked. Any help would be greatly appreciated.
Thanks a lot smile
[FYI]That's the finished product in my signature.[/FYI]