From e746f0babe468584c89c0d48fe06623499514493 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 22 Jul 2020 17:28:41 -0400 Subject: [PATCH] Use 0 instead of the word auto for scale --- web/skins/classic/views/frame.php | 17 ++++++++--------- web/skins/classic/views/js/frame.js | 6 +++--- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/web/skins/classic/views/frame.php b/web/skins/classic/views/frame.php index 64f1035b3..d8a60a15d 100644 --- a/web/skins/classic/views/frame.php +++ b/web/skins/classic/views/frame.php @@ -50,19 +50,19 @@ $lastFid = $maxFid; $alarmFrame = $Frame->Type() == 'Alarm'; -if ( isset( $_REQUEST['scale'] ) ) { +if ( isset($_REQUEST['scale']) ) { $scale = validNum($_REQUEST['scale']); -} else if ( isset( $_COOKIE['zmWatchScale'.$Monitor->Id()] ) ) { +} else if ( isset($_COOKIE['zmWatchScale'.$Monitor->Id()]) ) { $scale = validNum($_COOKIE['zmWatchScale'.$Monitor->Id()]); -} else if ( isset( $_COOKIE['zmWatchScale'] ) ) { +} else if ( isset($_COOKIE['zmWatchScale']) ) { $scale = validNum($_COOKIE['zmWatchScale']); } else { $scale = max(reScale(SCALE_BASE, $Monitor->DefaultScale(), ZM_WEB_DEFAULT_SCALE), SCALE_BASE); } -$scale = $scale ?: 'auto'; +$scale = $scale ? $scale : 0; -$imageData = $Event->getImageSrc( $frame, $scale, 0 ); -if ( ! $imageData ) { +$imageData = $Event->getImageSrc($frame, $scale, 0); +if ( !$imageData ) { ZM\Error("No data found for Event $eid frame $fid"); $imageData = array(); } @@ -89,10 +89,10 @@ xhtmlHeaders(__FILE__, translate('Frame').' - '.$Event->Id().' - '.$Frame->Frame
Id().'&fid='.$Frame->FrameId(), 'zmStats', 'stats', translate('Stats') ); } ?> - +
-
+

Id().'-'.$Frame->FrameId().' ('.$Frame->Score().')' ?>

@@ -100,7 +100,6 @@ xhtmlHeaders(__FILE__, translate('Frame').' - '.$Event->Id().' - '.$Frame->Frame

- ', $Event->Id(), $Frame->FrameId(), $scale, ( $show=='anal'?'capt':'anal' ) ); } ?> diff --git a/web/skins/classic/views/js/frame.js b/web/skins/classic/views/js/frame.js index a0a30eed4..37dae96ec 100644 --- a/web/skins/classic/views/js/frame.js +++ b/web/skins/classic/views/js/frame.js @@ -11,7 +11,7 @@ function changeScale() { if ( img ) { var baseWidth = $j('#base_width').val(); var baseHeight = $j('#base_height').val(); - if ( scale == 'auto' ) { + if ( ! parseInt(scale) ) { var newSize = scaleToFit(baseWidth, baseHeight, img, $j('#controls')); newWidth = newSize.width; newHeight = newSize.height; @@ -24,7 +24,7 @@ function changeScale() { img.css('width', newWidth + 'px'); img.css('height', newHeight + 'px'); } - Cookie.write( 'zmWatchScale', scale, {duration: 10*365} ); + Cookie.write('zmWatchScale', scale, {duration: 10*365}); $j.each(controlsLinks, function(k, anchor) { //Make frames respect scale choices if ( anchor ) { anchor.prop('href', anchor.prop('href').replace(/scale=.*&/, 'scale=' + scale + '&')); @@ -32,7 +32,7 @@ function changeScale() { }); } -if ( scale == 'auto' ) { +if ( !scale ) { $j(document).ready(changeScale); }