From bc4923b555c0cfb590d69e5b94d531523d629049 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 12 Aug 2016 13:50:18 -0400 Subject: [PATCH 1/5] use instead of for the frame object and pass to getImageSrc which expects an array --- web/skins/classic/views/frame.php | 32 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/web/skins/classic/views/frame.php b/web/skins/classic/views/frame.php index 29ddcc1d6..5988517c7 100644 --- a/web/skins/classic/views/frame.php +++ b/web/skins/classic/views/frame.php @@ -40,57 +40,57 @@ if ( !empty($fid) ) { } else { $frame = dbFetchOne( 'SELECT * FROM Frames WHERE EventId = ? AND Score = ?', NULL, array( $eid, $event['MaxScore'] ) ); } -$frame = new Frame( $frame ); +$Frame = new Frame( $frame ); $maxFid = $event['Frames']; $firstFid = 1; -$prevFid = $frame->FrameId()-1; -$nextFid = $frame->FrameId()+1; +$prevFid = $Frame->FrameId()-1; +$nextFid = $Frame->FrameId()+1; $lastFid = $maxFid; -$alarmFrame = $frame->Type()=='Alarm'; +$alarmFrame = $Frame->Type()=='Alarm'; if ( isset( $_REQUEST['scale'] ) ) $scale = validInt($_REQUEST['scale']); else $scale = max( reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE ); -$imageData = getImageSrc( $event, $frame->FrameId(), $scale, (isset($_REQUEST['show']) && $_REQUEST['show']=="capt") ); +$imageData = getImageSrc( $event, $frame, $scale, (isset($_REQUEST['show']) && $_REQUEST['show']=="capt") ); $imagePath = $imageData['thumbPath']; $eventPath = $imageData['eventPath']; -$dImagePath = sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-diag-d.jpg", $eventPath, $frame->FrameId() ); -$rImagePath = sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-diag-r.jpg", $eventPath, $frame->FrameId() ); +$dImagePath = sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-diag-d.jpg", $eventPath, $Frame->FrameId() ); +$rImagePath = sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-diag-r.jpg", $eventPath, $Frame->FrameId() ); $focusWindow = true; -xhtmlHeaders(__FILE__, translate('Frame')." - ".$event['Id']." - ".$frame->FrameId() ); +xhtmlHeaders(__FILE__, translate('Frame')." - ".$event['Id']." - ".$Frame->FrameId() ); ?>

-"> -<?php echo $frame->EventId().FrameId() ?>" class=""/> +"> +<?php echo $Frame->EventId().FrameId() ?>" class=""/>

-FrameId() > 1 ) { ?> +FrameId() > 1 ) { ?> -FrameId() > 1 ) { ?> +FrameId() > 1 ) { ?> -FrameId() < $maxFid ) { ?> +FrameId() < $maxFid ) { ?> -FrameId() < $maxFid ) { ?> +FrameId() < $maxFid ) { ?>

From 3dadcc8d32eabc413783d66e9ff76bd35568b1d0 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 12 Aug 2016 15:14:51 -0400 Subject: [PATCH 2/5] add ability to pass show=capture or show=analyse to getImageSrc --- web/includes/Frame.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/includes/Frame.php b/web/includes/Frame.php index 707569157..661654d24 100644 --- a/web/includes/Frame.php +++ b/web/includes/Frame.php @@ -69,8 +69,8 @@ class Frame { } - public function getImageSrc( ) { - return $_SERVER['PHP_SELF'].'?view=image&fid='.$this->{'Id'}; + public function getImageSrc( $show='capture' ) { + return $_SERVER['PHP_SELF'].'?view=image&fid='.$this->{'Id'}.'&show='.$show;; } // end function getImageSrc public static function find( $parameters = array(), $limit = NULL ) { From bcb7dd1ba400a3ca861059f5f0515d0e35a1abb4 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 12 Aug 2016 15:16:05 -0400 Subject: [PATCH 3/5] take optional show= to specify the analyse image or the capture image --- web/views/image.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/views/image.php b/web/views/image.php index 9bc242244..0135df7e0 100644 --- a/web/views/image.php +++ b/web/views/image.php @@ -61,18 +61,19 @@ $errorText = false; if ( empty($_REQUEST['path']) ) { if ( ! empty($_REQUEST['fid']) ) { + $show = empty($_REQUEST['show']) ? 'capture' : $_REQUEST['show']; if ( ! empty($_REQUEST['eid'] ) ) { $Event = new Event( $_REQUEST['eid'] ); $Frame = Frame::find_one( array( 'EventId' => $_REQUEST['eid'], 'FrameId' => $_REQUEST['fid'] ) ); if ( ! $Frame ) { Fatal("No Frame found for event(".$_REQUEST['eid'].") and frame id(".$_REQUEST['fid'].")"); } - $path = $Event->Path().'/'.sprintf("%'.0".ZM_EVENT_IMAGE_DIGITS.'d',$_REQUEST['fid']).'-capture.jpg'; + $path = $Event->Path().'/'.sprintf("%'.0".ZM_EVENT_IMAGE_DIGITS.'d',$_REQUEST['fid']).'-'.$show.'.jpg'; } else { # If we are only specifying fid, then the fid must be the primary key into the frames table. But when the event is specified, then it is the frame # $Frame = new Frame( $_REQUEST['fid'] ); $Event = new Event( $Frame->EventId() ); - $path = $Event->Path().'/'.sprintf("%'.0".ZM_EVENT_IMAGE_DIGITS.'d',$Frame->FrameId()).'-capture.jpg'; + $path = $Event->Path().'/'.sprintf("%'.0".ZM_EVENT_IMAGE_DIGITS.'d',$Frame->FrameId()).'-'.$show.'.jpg'; } } else { $errorText = "No image path"; From 9106675842a792ebb0480de6a71cb4d5f7a9c6a7 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 12 Aug 2016 15:17:13 -0400 Subject: [PATCH 4/5] pass capture or analyse to getImageSrc --- web/skins/classic/views/frame.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/skins/classic/views/frame.php b/web/skins/classic/views/frame.php index 5988517c7..fa2108f46 100644 --- a/web/skins/classic/views/frame.php +++ b/web/skins/classic/views/frame.php @@ -79,8 +79,10 @@ xhtmlHeaders(__FILE__, translate('Frame')." - ".$event['Id']." - ".$Frame->Frame

-"> -<?php echo $Frame->EventId().FrameId() ?>" class=""/> + +"> + +<?php echo $Frame->EventId().FrameId() ?>" class=""/>

From a0bc30d3fe70b6bcf23174fa2dc407a1ac71add5 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 12 Aug 2016 15:40:47 -0400 Subject: [PATCH 5/5] fix the order of analyse/capture being passed --- web/skins/classic/views/frame.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/skins/classic/views/frame.php b/web/skins/classic/views/frame.php index fa2108f46..abb4a3cc7 100644 --- a/web/skins/classic/views/frame.php +++ b/web/skins/classic/views/frame.php @@ -82,7 +82,7 @@ xhtmlHeaders(__FILE__, translate('Frame')." - ".$event['Id']." - ".$Frame->Frame "> -<?php echo $Frame->EventId().FrameId() ?>" class=""/> +<?php echo $Frame->EventId().FrameId() ?>" class=""/>