| View previous topic :: View next topic |
| Author |
Message |
unclerichy
Joined: 25 Feb 2004 Posts: 67
|
Posted: Tue Sep 27, 2005 9:41 pm Post subject: Open monitors from montage view |
|
|
I've made a quick patch to zm_html_view_montagefeed.php to enable a user to open up the full camera watch window by clicking on one of the montage images.
I have my montage set to 1/2 regular image size so when something happens that looks interesting in the montage view I can click on the image and have the full view pop up as if I'd launched it from the console.
NB: This only works in browsers that use the native jpeg streaming method, such as Firefox.
Diff -> http://www.hunter13.com/zm_montagefeed.diff.txt
Complete file -> http://www.hunter13.com/zm_html_view_montagefeed.php.txt |
|
| Back to top |
|
 |
|
|
jameswilson
Joined: 08 Jun 2005 Posts: 4997 Location: Midlands UK
|
Posted: Tue Sep 27, 2005 10:11 pm Post subject: |
|
|
Thanks I will have a play with this sounds nice
Good idea and good work!
James |
|
| Back to top |
|
 |
haus
Joined: 11 Oct 2007 Posts: 169
|
Posted: Sat Feb 23, 2008 7:42 pm Post subject: |
|
|
I tried this great contribution from unclerichy and found that when I put the php file into my Ubuntu 7.10 package install of 1.22, it messed up my montage scaling from the options panel (basically, my montage views no longer scaled properly; even though the image sizes on screen were the correct dimensions, the images themselves weren't scaled). Assuming this was because the montage scaling system may have changed since this patch was written in 2005, I modified it a bit and it seems to work for me now.
I left unclerichy's javascript:newWindow function alone at the top, and just added a little "echo" statement in the lower part that creates the link. This is a bit of a hack job (it doesn't even properly close the "<a>" tag), but so far it's working for me.
Allows clicking the montage image for a detail view of the monitor. You have to close your own windows; it's not smart enough to re-use the same pop-up window if you click another montage image.
If I haven't provided proper credit or if I've done something (other than poor coding) incorrectly, please let me know and give me a chance to correct it. I have never made a code contribution to anything before and I wanted to give something back (besides $) to the ZM community.
My edits to the stock 1.22 file - zm_html_view_montagefeed.php - below are surrounded by "//Haus Quick Edit" and "//Haus END Quick Edit"; the rest of the file is unchanged.
| Code: |
<?php
//
// ZoneMinder web montage feed view file, $Date: 2006/03/27 22:01:33 $, $Revision: 1.40 $
// Copyright (C) 2003, 2004, 2005, 2006 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.
//
if ( !canView( 'Stream' ) )
{
$view = "error";
return;
}
if ( empty($mode) )
{
if ( ZM_WEB_USE_STREAMS && canStream() )
$mode = "stream";
else
$mode = "still";
}
if ( ZM_OPT_CONTROL )
{
$sql = "select M.*,C.CanMoveMap,C.CanMoveRel from Monitors as M left join Controls as C on (M.ControlId = C.Id ) where M.Id = '$mid'";
}
else
{
$sql = "select * from Monitors where Id = '$mid'";
}
$result = mysql_query( $sql );
if ( !$result )
die( mysql_error() );
$monitor = mysql_fetch_assoc( $result );
mysql_free_result( $result );
$montage_width = ZM_WEB_MONTAGE_WIDTH?ZM_WEB_MONTAGE_WIDTH:reScale( $monitor['Width'], $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
$montage_height = ZM_WEB_MONTAGE_HEIGHT?ZM_WEB_MONTAGE_HEIGHT:reScale( $monitor['Height'], $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
$width_scale = ($montage_width*SCALE_BASE)/$monitor['Width'];
$height_scale = ($montage_height*SCALE_BASE)/$monitor['Height'];
$scale = (int)(($width_scale<$height_scale)?$width_scale:$height_scale);
if ( $mode != "stream" )
{
// Prompt an image to be generated
if ( ZM_WEB_REFRESH_METHOD == "http" )
header("Refresh: ".ZM_WEB_REFRESH_IMAGE."; URL=$PHP_SELF?view=montagefeed&mid=$mid&mode=still&scale=$scale" );
}
noCacheHeaders();
$image_src = getStreamSrc( array( "mode=single", "monitor=".$monitor['Id'], "scale=".$scale ) );
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><?= ZM_WEB_TITLE_PREFIX ?> - <?= $monitor['Name'] ?> - <?= $zmSlangFeed ?></title>
<link rel="stylesheet" href="zm_html_styles.css" type="text/css">
<script type="text/javascript">
//Haus Quick Edit: This was contributed by unclerichy of the Zoneminder Forums
function newWindow(Url,Name,Width,Height)
{
var Name = window.open(Url,Name,"resizable,width="+Width+",height="+Height);
}
//Haus END Quick Edit: The above was contributed by unclerichy of the Zoneminder Forums
<?php
if ( $mode != "stream" && ZM_WEB_REFRESH_METHOD == "javascript" )
{
if ( ZM_WEB_DOUBLE_BUFFER )
{
?>
function fetchImage()
{
var now = new Date();
var zm_image = new Image();
zm_image.src = '<?= $image_src ?>'+'&'+now.getTime();
document['zmImage'].src = zm_image.src;
}
window.setInterval( "fetchImage()", <?= ZM_WEB_REFRESH_IMAGE*1000 ?> );
<?php
}
else
{
?>
window.setTimeout( "window.location.reload(true)", <?= ZM_WEB_REFRESH_IMAGE*1000 ?> );
<?php
}
}
?>
</script>
</head>
<body>
<table width="100%" align="center" border="0" cellspacing="0" cellpadding="0">
<tr><td align="center">
<?php
if ( $mode == "stream" )
{
//Haus Quick Edit
echo('<a href="javascript:newWindow(\''.$PHP_SELF.'?view=watch&mid='.$monitor['Id'].'\',\'\')">');
//Haus End Quick Edit
if ( ZM_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT )
{
$stream_src = getStreamSrc( array( "mode=mpeg", "monitor=".$monitor['Id'], "scale=".$scale, "bitrate=".ZM_WEB_VIDEO_BITRATE, "maxfps=".ZM_WEB_VIDEO_MAXFPS, "format=".ZM_MPEG_LIVE_FORMAT ) );
outputVideoStream( $stream_src, reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ), $monitor['Name'], ZM_MPEG_LIVE_FORMAT );
}
else
{
$stream_src = getStreamSrc( array( "mode=jpeg", "monitor=".$mid, "scale=".$scale, "maxfps=".ZM_WEB_VIDEO_MAXFPS ) );
if ( canStreamNative() )
{
if ( $control && ($monitor['CanMoveMap'] || $monitor['CanMoveRel'] || $monitor['CanMoveCon']) )
{
outputControlStream( $stream_src, reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ), $monitor, $scale, "MontageSink".$mid );
}
else
{
outputImageStream( $stream_src, reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ), $monitor['Name'] );
}
}
else
{
outputHelperStream( $stream_src, reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ) );
}
}
}
else
{
if ( $control && ($monitor['CanMoveMap'] || $monitor['CanMoveRel'] || $monitor['CanMoveCon']) )
{
outputControlStill( $image_src, reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ), $monitor, $scale, "MontageSink".$mid );
}
else
{
outputImageStill( $image_src, reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ), $monitor['Name'] );
}
}
?>
</td></tr>
</table>
</body>
</html>
|
|
|
| Back to top |
|
 |
Lee Sharp
Joined: 31 Mar 2007 Posts: 1058 Location: Houston, TX
|
Posted: Sun Feb 24, 2008 8:01 pm Post subject: |
|
|
What version did you do this patch on?
As an aside, this is a wonderful patch. I have many customers ask for this. Why is it not folded into the mainstream? |
|
| Back to top |
|
 |
cordel

Joined: 05 Mar 2004 Posts: 5147 Location: /USA/Washington/Seattle
|
Posted: Sun Feb 24, 2008 9:06 pm Post subject: |
|
|
| Actualy this function is in ZM but only when you stream jpeg is it functional, Never really sat down to look at it. |
|
| Back to top |
|
 |
haus
Joined: 11 Oct 2007 Posts: 169
|
Posted: Mon Feb 25, 2008 3:22 am Post subject: |
|
|
Lee, I'm using 1.22.3-8.deb or 1.22.3-9.deb (Peter Howard's fine work) on Ubuntu 7.04 server; I'm not sure which, though I'm pretty sure there's no change in the montage view between those two releases as I don't recall anything in the changelogs about it.
Cordel, I have "jpeg" selected under Options -> Images -> ZM_STREAM_METHOD. But until I edited the file above, I wasn't able to click the montage images. Am I missing a setting? If so, I feel sort of silly for changing the php file if the functionality is already there, but I'm not seeing it. |
|
| Back to top |
|
 |
cordel

Joined: 05 Mar 2004 Posts: 5147 Location: /USA/Washington/Seattle
|
Posted: Mon Feb 25, 2008 3:49 am Post subject: |
|
|
Well unless I patched it to do so n my package, it already does so. I'll have to go back and look  |
|
| Back to top |
|
 |
Lee Sharp
Joined: 31 Mar 2007 Posts: 1058 Location: Houston, TX
|
Posted: Mon Feb 25, 2008 10:04 pm Post subject: |
|
|
| Well, none of the unpatched systems I have can do it, and I have many people beating me over the head for it. I will be playing with this patch soon! |
|
| Back to top |
|
 |
haus
Joined: 11 Oct 2007 Posts: 169
|
Posted: Mon Feb 25, 2008 10:14 pm Post subject: |
|
|
LOL don't let them beat you over the head!
I'm really enjoying this functionality now. I've got my montage thumbnails down to 160x120, so I can fit 9 monitors in a pretty small window, and then when Something Interesting Happens I can click and bring up the 320x240 pic and get a better view. |
|
| Back to top |
|
 |
Lee Sharp
Joined: 31 Mar 2007 Posts: 1058 Location: Houston, TX
|
Posted: Wed Feb 27, 2008 8:36 pm Post subject: |
|
|
| haus wrote: | LOL don't let them beat you over the head!  |
It's OK. I have it on camera...  |
|
| Back to top |
|
 |
Lee Sharp
Joined: 31 Mar 2007 Posts: 1058 Location: Houston, TX
|
Posted: Thu Mar 13, 2008 10:27 pm Post subject: |
|
|
| Has anyone played with this in Peters new deb yet? |
|
| Back to top |
|
 |
coke
Joined: 30 Jan 2008 Posts: 517 Location: St. Louis, MO, USA
|
Posted: Thu Mar 13, 2008 10:33 pm Post subject: |
|
|
| Zoneminder 1.23.2, Ubuntu 7.10, Firefox 2.0.0.12, doesn't appear to work. |
|
| Back to top |
|
 |
haus
Joined: 11 Oct 2007 Posts: 169
|
Posted: Fri Mar 14, 2008 4:39 am Post subject: |
|
|
I've never used 1.23, so I can't say what might be different in the zm_html_view_montagefeed.php file. If I upgrade to 1.23 I'll re-work the patch, but with a functioning 1.22 system I'm not sure there's enough new stuff in 1.23 to make me go through all the hassle of install/setup again...(sorry) - I'm a "don't mess with success" kind of guy.
If someone wants to run a diff between my zm_html_view_montagefeed.php file (as posted above) and that of a stock 1.23, it should become clear if there are massive changes between the two versions that would indicate how hard it would be to make this work under 1.23. |
|
| Back to top |
|
 |
ammaross

Joined: 12 Mar 2007 Posts: 61 Location: Utah, USA
|
|
| Back to top |
|
 |
haus
Joined: 11 Oct 2007 Posts: 169
|
Posted: Mon Jun 02, 2008 6:55 pm Post subject: |
|
|
Ammaross,
Sorry - didn't mean to steal focus or not give credit to your earlier solution - I didn't know about your post/contribution. When I did a forum search, I only came up with unclerichy's thread, or I saw it and pounced on it without spending enough time reviewing all the info.
Nonetheless, echoing Lee's earlier comment, it would be great to see some of this stuff baked into ZM, rather than requiring patches. This has got to be one of the more useful changes for anyone who doesn't do full-size montage views. |
|
| Back to top |
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|