the code is below for anyone who wants one that works on php4+
Code: Select all
<?php
/**
* @author Rob France
*/
$myfile = new RecursiveDirectoryIterator("webcam/");
$display = Array ('jpeg', 'jpg' );
foreach(new RecursiveIteratorIterator($myfile) as $file)
{
if (in_array(strtolower(array_pop(explode('.', $file))), $display))
/** echo "<img src='" . $file . "'width='600' height='400'><br/> \n";
uncomment the above to display the images */
echo $file . "<br/> \n";
}
?>
its been a lot of headaches trying to get all the recursive stuff to work
webcams is a subdirectory of the root from where the script is run
another one getimages.php will give the images using the same code but theres a lot of them and i dont want to blow peoples bandwidth
There is probably also a much better way of doing this using glob functions or similar but I cant convince my hosting people to get away from php4
I have used the filenames Cam1_ cam2_ etc and the dates are the main folder names apart from a few rogues that have crept in there.