From 91810efbd45d16111d1f5dcfd61e2f8bbde3ddb3 Mon Sep 17 00:00:00 2001 From: stan Date: Thu, 19 Feb 2004 15:05:21 +0000 Subject: [PATCH] Refined cycle view. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@875 e3e1d417-86f3-4887-817a-d78f3d33393f --- web/zm_config.php.z | 2 +- web/zm_html_view_cycle.php | 33 +++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/web/zm_config.php.z b/web/zm_config.php.z index 6c3f32270..e3120b319 100644 --- a/web/zm_config.php.z +++ b/web/zm_config.php.z @@ -127,7 +127,7 @@ $jws = array( 'console' => array( 'w'=>720, 'h'=>540 ), 'state' => array( 'w'=>300, 'h'=>120 ), 'version' => array( 'w'=>320, 'h'=>140 ), - 'cycle' => array( 'w'=>46, 'h'=>80 ), + 'cycle' => array( 'w'=>16, 'h'=>32 ), 'montage' => array( 'w'=>20, 'h'=>20 ), 'monitor' => array( 'w'=>360, 'h'=>300 ), 'watch' => array( 'w'=>72, 'h'=>342 ), diff --git a/web/zm_html_view_cycle.php b/web/zm_html_view_cycle.php index cf44929a7..a121083eb 100644 --- a/web/zm_html_view_cycle.php +++ b/web/zm_html_view_cycle.php @@ -23,7 +23,7 @@ if ( !canView( 'Stream' ) ) $view = "error"; return; } -if ( !isset($mode) ) +if ( empty($mode) ) { if ( canStream() ) $mode = "stream"; @@ -34,6 +34,8 @@ if ( !isset($mode) ) $result = mysql_query( "select * from Monitors where Function != 'None' order by Id" ); $monitors = array(); $mon_idx = 0; +$max_width = 0; +$max_height = 0; while( $row = mysql_fetch_assoc( $result ) ) { if ( !visibleMonitor( $row['Id'] ) ) @@ -42,6 +44,8 @@ while( $row = mysql_fetch_assoc( $result ) ) } if ( isset($mid) && $row['Id'] == $mid ) $mon_idx = count($monitors); + if ( $max_width < $row['Width'] ) $max_width = $row['Width']; + if ( $max_height < $row['Height'] ) $max_height = $row['Height']; $monitors[] = $row; } @@ -49,13 +53,18 @@ $monitor = $monitors[$mon_idx]; $next_mid = $mon_idx==(count($monitors)-1)?$monitors[0]['Id']:$monitors[$mon_idx+1]['Id']; $montage_width = ZM_WEB_MONTAGE_WIDTH?ZM_WEB_MONTAGE_WIDTH:$monitor['Width']; $montage_height = ZM_WEB_MONTAGE_HEIGHT?ZM_WEB_MONTAGE_HEIGHT:$monitor['Height']; +$width_scale = ($montage_width*SCALE_SCALE)/$monitor['Width']; +$height_scale = ($montage_height*SCALE_SCALE)/$monitor['Height']; +$scale = (int)(($width_scale<$height_scale)?$width_scale:$height_scale); + +if ( $mode != "stream" ) +{ + // Prompt an image to be generated + createImage( $monitor, $scale ); + if ( ZM_WEB_REFRESH_METHOD == "http" ) + header("Refresh: ".REFRESH_IMAGE."; URL=$PHP_SELF?view=watchfeed&mid=$mid&mode=still" ); +} -// Prompt an image to be generated -chdir( ZM_DIR_IMAGES ); -$status = exec( escapeshellcmd( ZMU_COMMAND." -m ".$monitor['Id']." -i" ) ); - -if ( ZM_WEB_REFRESH_METHOD == "http" ) - header("Refresh: ".REFRESH_CYCLE."; URL=$PHP_SELF?view=cycle&mid=$next_mid&mode=$mode" ); 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 @@ -86,7 +95,7 @@ window.setTimeout( "window.location.replace( ' - + @@ -102,24 +111,24 @@ window.setTimeout( "window.location.replace( ' - + - + - +