Commit 02645398 authored by Mitchell Pomery's avatar Mitchell Pomery

Stops bvreaking w=for no apparant reason

parent ec780f94
...@@ -2,16 +2,20 @@ ...@@ -2,16 +2,20 @@
$camera = 'nocamera'; $camera = 'nocamera';
if (isset($_GET['camera'])) if (isset($_GET['camera']))
$camera=$_GET['camera']; $camera=$_GET['camera'];
$imagelocation="../../"; $imagelocation="../";
$file = $imagelocation.strtolower($camera).".jpg"; $file = $imagelocation.strtolower($camera).".jpg";
$statusfile = $imagelocation.strtolower($camera).".status";
//echo $file; //echo $file;
header("Expires: ".gmdate("D, d M Y H:i:s", time())." GMT"); header("Expires: ".gmdate("D, d M Y H:i:s", time())." GMT");
if (!is_readable($file)) { if (!is_readable($file)) {
$file="nocamera.jpg"; $file="nocamera.jpg";
} }
if (file_exists($statusfile))
usleep(250000);
header("Content-Type: image/jpeg"); header("Content-Type: image/jpeg");
header("Content-Length: ".filesize($file)); header("Content-Length: ".filesize($file));
header("Last-Modified: ".gmdate("D, d M Y H:i:s", filectime($file))." GMT"); $fps = stat($file);
header("Last-Modified: ".gmdate("D, d M Y H:i:s", $fps[9])." GMT");
$fp = fopen($file, 'rb'); $fp = fopen($file, 'rb');
fpassthru($fp); fpassthru($fp);
fclose($fp); fclose($fp);
......
...@@ -33,7 +33,7 @@ body { ...@@ -33,7 +33,7 @@ body {
} }
.offline { .offline {
opacity: 0.1; /*opacity: 0.1;*/
} }
/* Haven't touched anything below this */ /* Haven't touched anything below this */
......
function windowOnload() function windowOnload()
{ {
updateTime(); updateTime();
setInterval("updateTime()",15000); setInterval("updateTime()", 15000);
} }
function updateWebcam (webcamid, webcamurl) function updateWebcam (webcamid, webcamurl)
...@@ -37,13 +37,17 @@ function updateWebcam (webcamid, webcamurl) ...@@ -37,13 +37,17 @@ function updateWebcam (webcamid, webcamurl)
{ {
var imgdate = new Date (Date.parse (req.getResponseHeader ("Last-Modified"))); var imgdate = new Date (Date.parse (req.getResponseHeader ("Last-Modified")));
var servdate = new Date (Date.parse (req.getResponseHeader ("Date"))); var servdate = new Date (Date.parse (req.getResponseHeader ("Date")));
if (Math.abs (imgdate.getTime () - servdate.getTime ()) > 1000 * 60 * 2) if (Math.abs (imgdate.getTime () - servdate.getTime ()) > 1000 * 60 * 3)
{ {
console.log("Out Of Sync");
console.log("imgdate: " + imgdate);
console.log("servdate: " + servdate);
// this image is out of date // this image is out of date
img.classList.add('offline'); img.classList.add('offline');
} }
else else
{ {
//console.log("In Sync");
img.classList.remove('offline'); img.classList.remove('offline');
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment