Skip to content

Commit

Permalink
Merge pull request #4089 from IgorA100/patch-153
Browse files Browse the repository at this point in the history
Feat: Show the camera image on the monitor editing page on the Viewing tab
  • Loading branch information
connortechnology authored Jul 14, 2024
2 parents e8aaee4 + 3d11c11 commit c8a4933
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions web/skins/classic/views/js/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,9 @@ function initPage() {
} // end if ZM_OPT_USE_GEOLOCATION

updateLinkedMonitorsUI();

// Setup the thumbnail video animation
if (!isMobile()) initThumbAnimation();
} // end function initPage()

function ll2dms(input) {
Expand Down
28 changes: 28 additions & 0 deletions web/skins/classic/views/monitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,34 @@ class="nav-link<?php echo $tab == $name ? ' active' : '' ?>"
);
echo htmlSelect('newMonitor[DefaultCodec]', $codecs, $monitor->DefaultCodec()); ?>
</li>
<li>
<?php
$stream_available = canView('Stream') and $monitor->Type()=='WebSite' or ($monitor->CaptureFPS() && $monitor->Capturing() != 'None');
$options = array();

$ratio_factor = $monitor->ViewWidth() ? $monitor->ViewHeight() / $monitor->ViewWidth() : 1;
$options['width'] = ZM_WEB_LIST_THUMB_WIDTH;
$options['height'] = ZM_WEB_LIST_THUMB_HEIGHT ? ZM_WEB_LIST_THUMB_HEIGHT : ZM_WEB_LIST_THUMB_WIDTH*$ratio_factor;
$options['scale'] = $monitor->ViewWidth() ? intval(100*ZM_WEB_LIST_THUMB_WIDTH / $monitor->ViewWidth()) : 100;
$options['mode'] = 'jpeg';
$options['frames'] = 1;

$stillSrc = $monitor->getStreamSrc($options);
$streamSrc = $monitor->getStreamSrc(array('scale'=>$options['scale']*5));

$thmbWidth = ( $options['width'] ) ? 'width:'.$options['width'].'px;' : '';
$thmbHeight = ( $options['height'] ) ? 'height:'.$options['height'].'px;' : '';

$imgHTML = '<div class="colThumbnail" style="'.$thmbHeight.'"><a';
$imgHTML .= $stream_available ? ' href="?view=watch&amp;mid='.$monitor->Id().'">' : '>';
$imgHTML .= '<img id="thumbnail' .$monitor->Id(). '" src="' .$stillSrc. '" style="'
.$thmbWidth.$thmbHeight. '" stream_src="' .$streamSrc. '" still_src="' .$stillSrc. '"'.
($options['width'] ? ' width="'.$options['width'].'"' : '' ).
($options['height'] ? ' height="'.$options['height'].'"' : '' ).
' loading="lazy" /></a></div>';
echo $imgHTML;
?>
</li>
<?php
break;
case 'timestamp' :
Expand Down

0 comments on commit c8a4933

Please sign in to comment.