Page 1 of 1

php recursive directory search working for webcams

Posted: Fri 27 Feb 2015 12:17 pm
by Warrandyte
http://www.warrandytefarm.com/test/getimagenames.php

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";
}
?>
now I have that's going (and its a real pain to do so), I need to filter by camera number and date, probably using drop downs but I get kind of stuck there.

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 there's a lot of them and i don't 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.

Re: php recursive directory search working for webcams

Posted: Mon 02 Mar 2015 1:40 pm
by TNETWeather
Seriously, get a new web host if they are not upgrading the Insecure PHP4 to current PHP5. There is no excuse for that. Especially with all the new security issues that have been released over the past 4-6 months.

PHP Support:
Support for PHP 4 has been discontinued since 2007-12-31.

Ref:
http://php.net/releases/

Re: php recursive directory search working for webcams

Posted: Mon 02 Mar 2015 10:52 pm
by Warrandyte
Kevin.
My mistake. It was 5.4... And i needed 5.5 so theyre not too bad once you can get around the phillipino need to script and reiterate every sentence of a conversation.

I live in a more remote part of Australia and they have one of the few intrfaces that isnt image intensive so i can actually use it on my lousy broadband connection.
Something i also love about Cumulus.

Great work with all your wx related stuff.

Im thinking one day we should all get together and get Steve to incorporate an advanced version for newbies rather than collect various bits and pieces from around the web. Only problem is there been too much great work done by so many people that it would be hard to know what to leave out.

Im offline for a few days as our latest addition has choaen not to wait the extra 3 weeks till his due date.

Rob