From 2f0df74c547c4d2e5038d7b85b4956c083a98f39 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Sat, 12 Dec 2020 11:37:50 -0600 Subject: [PATCH] show the analyse image in frames view if it exists --- web/ajax/frames.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/web/ajax/frames.php b/web/ajax/frames.php index e85988dbc..e129200e7 100644 --- a/web/ajax/frames.php +++ b/web/ajax/frames.php @@ -161,15 +161,30 @@ function queryRequest($eid, $search, $advsearch, $sort, $offset, $order, $limit) $returned_rows = array(); foreach ( array_slice($filtered_rows, $offset, $limit) as $row ) { if ( ZM_WEB_LIST_THUMBS ) { + + # Build the path to the potential analysis image + $analImage = sprintf('%0'.ZM_EVENT_IMAGE_DIGITS.'d-analyse.jpg', $row['FrameId']); + $analPath = $Event->Path().'/'.$analImage; + $alarmFrame = $row['Type'] == 'Alarm'; + $hasAnalImage = $alarmFrame && file_exists($analPath) && filesize($analPath); + + # Our base img source component, which we will add on to $base_img_src = '?view=image&fid=' .$row['Id']; + + # if an analysis images exists, use it as the thumbnail + if ( $hasAnalImage ) $base_img_src .= '&show=analyse'; + + # Build the subcomponents needed for the image source $ratio_factor = $Monitor->ViewHeight() / $Monitor->ViewWidth(); $thmb_width = ZM_WEB_LIST_THUMB_WIDTH ? 'width='.ZM_WEB_LIST_THUMB_WIDTH : ''; $thmb_height = 'height="'.( ZM_WEB_LIST_THUMB_HEIGHT ? ZM_WEB_LIST_THUMB_HEIGHT : ZM_WEB_LIST_THUMB_WIDTH*$ratio_factor ) .'"'; $thmb_fn = 'filename=' .$Event->MonitorId(). '_' .$row['EventId']. '_' .$row['FrameId']. '.jpg'; + + # Assemble the scaled and unscaled image source image source components $img_src = join('&', array_filter(array($base_img_src, $thmb_width, $thmb_height, $thmb_fn))); $full_img_src = join('&', array_filter(array($base_img_src, $thmb_fn))); - $frame_src = '?view=frame&eid=' .$row['EventId']. '&fid=' .$row['FrameId']; + # finally, we assemble the the entire thumbnail img src structure, whew $row['Thumbnail'] = ''; } $returned_rows[] = $row;