So this wasnt easy, but I made it work, here's how.
Using Security Spy (SS) I set up cameras to take images at a regular interval, and movies and images when triggered by motion. I run a server so I set the images to be save at a specific location available via the intranet.
Now the issue arises where I cannot control the names of the image files. Meaning, I cant tell SS to save the image at a specific location and just name it 'Living_Room.jpg'. It gets put into a dated folder, with the name of the camera name and timestamp (ie: 1969-01-31 00-00-00 LivingRoom.jpg) I get the logic, however a little more control would be nice.
Now we have the fact that Indigo control pages will only accept an image URL. So I created a webpage at the URL location respective to a folder for each camera location name with the code below (index.php). So Indigo is set for each control page item to look at that URL location, at the index.php file.
- Code: Select all
<?php
$dir = "/path/to/dir/with/images/for/location";
// we only want to look at these files
$pattern = '\.(jpeg|jpg|png|gif)$';
$newstamp = "";
$newname = "";
// lets start looking!
if ($handle = opendir($dir)) {
while (false !== ($fname = readdir($handle))) {
if (ereg('^\.{1,2}$',$fname)) continue;
if (! ereg($pattern,$fname)) continue;
// if current file is newer, store it
$timedat = filemtime("$dir/$fname");
if ($timedat > $newstamp) {
$newstamp = $timedat;
$newname = $fname;
}
}
}
closedir ($handle);
// set the path to most recent file
$fileLocation = date("Y-m-d") . "/" . $newname;
// redirect to the most recent image
header("Location:".$fileLocation);
?>
This means that when the control page searches for the image at index.php, it actually gets redirected to the most recent image file.
You can expand this further to create web pages with all the images in a slideshow, and all the movies in a gallery (which Ill do at some point).
I would also recommend using .htaccess to only allow access from the local intranet.
- Code: Select all
<FilesMatch "\.(gif|jpe?g|png|php)$">
Order deny,allow
Deny from all
Allow from 10.0
Allow from 192.168
Allow from 10.1
</FilesMatch>
I hope this helps some people!