camera.php 635 Bytes
Newer Older
mpomery's avatar
mpomery committed
1
<?php
mpomery's avatar
mpomery committed
2
3
	$camera = 'nocamera';
	if (isset($_GET['camera']))
Mitchell Pomery's avatar
Mitchell Pomery committed
4
		$camera=$_GET['camera'];
5
	$imagelocation="../";
mpomery's avatar
mpomery committed
6
	$file = $imagelocation.strtolower($camera).".jpg";
7
	$statusfile = $imagelocation.strtolower($camera).".status";
Mitchell Pomery's avatar
Mitchell Pomery committed
8
	//echo $file;
mpomery's avatar
mpomery committed
9
	header("Expires: ".gmdate("D, d M Y H:i:s", time())." GMT");
Mitchell Pomery's avatar
Mitchell Pomery committed
10
	if (!is_readable($file)) {
mpomery's avatar
mpomery committed
11
		$file="nocamera.jpg";
Mitchell Pomery's avatar
Mitchell Pomery committed
12
	}
13
14
	if (file_exists($statusfile))
		usleep(250000);
mpomery's avatar
mpomery committed
15
16
	header("Content-Type: image/jpeg");
	header("Content-Length: ".filesize($file));
17
18
	$fps = stat($file);
	header("Last-Modified: ".gmdate("D, d M Y H:i:s", $fps[9])." GMT");
mpomery's avatar
mpomery committed
19
20
21
22
	$fp = fopen($file, 'rb');
	fpassthru($fp);
	fclose($fp);
?>