Tronjim, we helped someone else awhile ago do a similar project. It seemed to be an easy small amount
of code to do that. Depends a little on how the format of the filename is. If it is timestamped first, you can
just do it this way. You need PHP5 or higher to use the scandir function…
[php]
$files = scandir(‘pointer_to_folder’, SCANDIR_SORT_DESCENDING);
$newest_file = $files[0];
[/php]
For older versions, you need to check the creation times of each file and locate the newest. Sort of like this:
[php]
$path = “/pointer_to_folder/some_folder”;
$latest_ctime = 0;
$latest_filename = ‘’;
$d = dir($path);
while (false !== ($entry = $d->read())) {
$filepath = “{$path}/{$entry}”;
// could do also other checks than just checking whether the entry is a file
if (is_file($filepath) && filectime($filepath) > $latest_ctime) {
$latest_ctime = filectime($filepath);
$latest_filename = $entry;
}
}
[/php]
Create a loop for each of the 8 folders and display them. Easy…
To keep it up to date, use Javascript or JQuery. Here is a routine that will do that for you. It is set for
once per minute. That should give your cam’s enough time to update. You can lower the time, but, it can
cause issues if you refresh too fast. This code also is set up not to refresh if the user is using the page.
( If you lock it in without this, sometimes the page won’t let you in to do anything else. Had that before!)
[php]
[/php]
If you have only the pictures on the page without any inputs or buttons, you can do it without the checks
for mousemoves and keypresses. But, normally, you have some sort of options on the page.
Hope this helps…