2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
//
|
|
|
|
// ZoneMinder web watch feed view file, $Date$, $Revision$
|
|
|
|
// Copyright (C) 2003 Philip Coombes
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
//
|
2003-07-11 17:27:56 +08:00
|
|
|
|
2004-01-08 19:45:57 +08:00
|
|
|
if ( !canView( 'Stream' ) )
|
|
|
|
{
|
|
|
|
$view = "error";
|
|
|
|
return;
|
|
|
|
}
|
2004-02-18 23:36:35 +08:00
|
|
|
|
|
|
|
if ( empty($mode) )
|
2004-01-08 19:45:57 +08:00
|
|
|
{
|
|
|
|
if ( canStream() )
|
|
|
|
$mode = "stream";
|
|
|
|
else
|
|
|
|
$mode = "still";
|
|
|
|
}
|
2003-07-11 17:27:56 +08:00
|
|
|
|
2004-02-19 18:48:33 +08:00
|
|
|
if ( !isset( $scale ) )
|
|
|
|
$scale = SCALE_SCALE;
|
|
|
|
|
2004-01-08 19:45:57 +08:00
|
|
|
$result = mysql_query( "select * from Monitors where Id = '$mid'" );
|
|
|
|
if ( !$result )
|
|
|
|
die( mysql_error() );
|
|
|
|
$monitor = mysql_fetch_assoc( $result );
|
|
|
|
|
|
|
|
if ( $mode != "stream" )
|
|
|
|
{
|
2004-02-19 18:48:33 +08:00
|
|
|
if ( !ZM_WEB_DOUBLE_BUFFER )
|
|
|
|
{
|
|
|
|
// Prompt an image to be generated
|
|
|
|
createImage( $monitor, $scale );
|
|
|
|
}
|
2004-01-08 19:45:57 +08:00
|
|
|
if ( ZM_WEB_REFRESH_METHOD == "http" )
|
2004-02-19 18:48:33 +08:00
|
|
|
header("Refresh: ".REFRESH_IMAGE."; URL=$PHP_SELF?view=watchfeed&mid=$mid&mode=still&scale=$scale" );
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
|
|
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
|
|
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
|
|
|
|
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
|
|
|
|
header("Cache-Control: post-check=0, pre-check=0", false);
|
|
|
|
header("Pragma: no-cache"); // HTTP/1.0
|
|
|
|
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
|
|
|
<html>
|
|
|
|
<head>
|
2004-01-08 18:09:35 +08:00
|
|
|
<title>ZM - <?= $monitor['Name'] ?> - <?= $zmSlangFeed ?></title>
|
2003-07-11 17:27:56 +08:00
|
|
|
<link rel="stylesheet" href="zm_styles.css" type="text/css">
|
|
|
|
<script language="JavaScript">
|
2004-02-19 18:48:33 +08:00
|
|
|
<?php
|
|
|
|
if ( $mode != "stream" && ZM_WEB_REFRESH_METHOD == "javascript" )
|
2003-07-11 17:27:56 +08:00
|
|
|
{
|
2004-02-19 18:48:33 +08:00
|
|
|
if ( ZM_WEB_DOUBLE_BUFFER )
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
function fetchImage()
|
2003-07-11 17:27:56 +08:00
|
|
|
{
|
2004-02-19 21:02:05 +08:00
|
|
|
window.parent.MonitorFetch<?= $monitor['Id'] ?>.location.reload( true );
|
2004-02-19 18:48:33 +08:00
|
|
|
|
2004-02-20 17:48:14 +08:00
|
|
|
var now = new Date();
|
|
|
|
var zm_image = new Image();
|
|
|
|
zm_image.src = '<?= ZM_DIR_IMAGES.'/'.$monitor['Name'] ?>.jpg?'+now.getTime();
|
2004-02-19 18:48:33 +08:00
|
|
|
|
|
|
|
document['zmImage'].src = zm_image.src;
|
2003-07-11 17:27:56 +08:00
|
|
|
}
|
2004-02-19 18:48:33 +08:00
|
|
|
|
2004-02-19 21:02:05 +08:00
|
|
|
window.parent.MonitorFetch<?= $monitor['Id'] ?>.location = '<?= $PHP_SELF ?>?view=imagefetch&mid=<?= $monitor['Id'] ?>&scale=<?= $scale ?>';
|
2004-02-19 18:48:33 +08:00
|
|
|
window.setInterval( "fetchImage()", <?= REFRESH_IMAGE*1000 ?> );
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-02-19 18:48:33 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
|
|
|
window.setTimeout( "window.location.reload(true)", <?= REFRESH_IMAGE*1000 ?> );
|
|
|
|
<?php
|
2004-02-19 18:48:33 +08:00
|
|
|
}
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
2004-02-19 18:48:33 +08:00
|
|
|
<table width="96%" align="center" border="0" cellspacing="0" cellpadding="2">
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
if ( $mode == "stream" )
|
|
|
|
{
|
|
|
|
$stream_src = ZM_PATH_ZMS."?monitor=".$monitor['Id']."&idle=".STREAM_IDLE_DELAY."&refresh=".STREAM_FRAME_DELAY."&scale=$scale";
|
2004-01-27 17:57:12 +08:00
|
|
|
if ( canStreamNative() )
|
2003-07-11 17:27:56 +08:00
|
|
|
{
|
|
|
|
?>
|
2004-01-08 18:09:35 +08:00
|
|
|
<tr><td colspan="5" align="center"><img src="<?= $stream_src ?>" border="0" width="<?= reScale( $monitor['Width'], $scale ) ?>" height="<?= reScale( $monitor['Height'], $scale ) ?>"></td></tr>
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
2004-01-08 18:09:35 +08:00
|
|
|
<tr><td colspan="5" align="center"><applet code="com.charliemouse.cambozola.Viewer" archive="<?= ZM_PATH_CAMBOZOLA ?>" align="middle" width="<?= reScale( $monitor['Width'], $scale ) ?>" height="<?= reScale( $monitor['Height'], $scale ) ?>"><param name="url" value="<?= $stream_src ?>"></applet></td></tr>
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
|
|
|
}
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
2004-02-19 18:48:33 +08:00
|
|
|
<tr><td colspan="5" align="center"><img name="zmImage" src="<?= ZM_DIR_IMAGES.'/'.$monitor['Name'] ?>.jpg" border="0" width="<?= reScale( $monitor['Width'], $scale ) ?>" height="<?= reScale( $monitor['Height'], $scale ) ?>"></td></tr>
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
|
|
|
</table>
|
|
|
|
</body>
|
|
|
|
</html>
|