Random image display in Flash
Posted: Mon Feb 09, 2009 4:12 pm
Hi,
I have a site with a flash header that randomly pulls an image from a directory for the next image in the slideshow.
Right now it works, but only if the page is in the same directory as the folder for the pics. If the page is in a different directory, it will not load the images. Also, if the page is https instead of http it will not insert the images, and if the page is http://website.com instead of http://www.website.com it will not work.
here is the code that i think needs to be altered to allow for absolute path rather than relative?
any help would be appreciated. thanks
I have a site with a flash header that randomly pulls an image from a directory for the next image in the slideshow.
Right now it works, but only if the page is in the same directory as the folder for the pics. If the page is in a different directory, it will not load the images. Also, if the page is https instead of http it will not insert the images, and if the page is http://website.com instead of http://www.website.com it will not work.
here is the code that i think needs to be altered to allow for absolute path rather than relative?
Code: Select all
<?php
$dir = "pics";
$dh = opendir($dir);
while (false !== ($filename = readdir($dh))) {
$newPics[] = $filename;
}
sort($newPics);
for ($i = 1; $i < sizeof($newPics); ++$i) {
$paths = $paths . $newPics[$i];
if ($i < sizeof($newPics)-1){
$paths = $paths . ',';
}
}
echo "paths=" . $paths;
?>