Merge branch 'monitorSize' of git://github.com/chriswiggins/ZoneMinder into modern
This commit is contained in:
commit
99bae6386e
|
@ -5,7 +5,7 @@
|
|||
public function index() {
|
||||
$zmBandwidth = $this->Cookie->read('zmBandwidth');
|
||||
$this->set('width', Configure::read('ZM_WEB_LIST_THUMB_WIDTH'));
|
||||
$monitoroptions = array('fields' => array('Name', 'Id', 'Function', 'Enabled', 'Sequence', 'Function'), 'order' => 'Sequence ASC', 'recursive' => -1);
|
||||
$monitoroptions = array('fields' => array('Name', 'Id', 'Function', 'Enabled', 'Sequence', 'Function', 'Width'), 'order' => 'Sequence ASC', 'recursive' => -1);
|
||||
$this->set('monitors', $this->Monitor->find('all', $monitoroptions));
|
||||
$monitors = $this->Monitor->find('all', array('recursive' => -1, 'fields' => array('Id', 'StreamReplayBuffer')));
|
||||
foreach ($monitors as $monitor => $mon) {
|
||||
|
|
|
@ -3,12 +3,12 @@ App::uses('AppHelper', 'View/Helper');
|
|||
|
||||
class LiveStreamHelper extends AppHelper {
|
||||
public function makeLiveStream($name, $src, $id, $width=0) {
|
||||
$liveStream = "<img id=\"liveStream_$id\" alt=\"Live Stream of $name\" src=\"$src&monitor=$id\" width=\"$width\">";
|
||||
$liveStream = "<img class=\"livestream_resize\" id=\"liveStream_$id\" alt=\"Live Stream of $name\" src=\"$src&monitor=$id\" width=\"$width\">";
|
||||
return $liveStream;
|
||||
}
|
||||
|
||||
public function showNoImage($name, $src, $id, $width=0) {
|
||||
$liveStream = "<img id=\"liveStream_$id\" alt=\"Live Stream of $name\" src=\"/img/no-image.jpg\".width?\"width=\"$width\">";
|
||||
$liveStream = "<img class=\"livestream_resize\" id=\"liveStream_$id\" alt=\"No Live stream available for $name\" src=\"/img/no-image.png\">";
|
||||
return $liveStream;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<div class="thumbnail">
|
||||
<?php
|
||||
if($daemonStatus && $mon['Monitor']['Function'] != "None" && $mon['Monitor']['Enabled'])
|
||||
echo $this->LiveStream->makeLiveStream($mon['Monitor']['Name'], $streamSrc[$monitor], $mon['Monitor']['Id'], $width);
|
||||
echo $this->LiveStream->makeLiveStream($mon['Monitor']['Name'], $streamSrc[$monitor], $mon['Monitor']['Id'], $mon['Monitor']['Width']);
|
||||
else
|
||||
echo $this->LiveStream->showNoImage($mon['Monitor']['Name'], $streamSrc[$monitor], $mon['Monitor']['Id'], $width);
|
||||
?>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 8.8 KiB |
|
@ -199,6 +199,17 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$(".livestream_resize").each(function(index, element){
|
||||
if($(element).attr('src').indexOf('scale=') >= 0){
|
||||
var newScale = Math.ceil(($(element).width() / $(element).attr('width')) * 100);
|
||||
var src = $(element).attr('src').replace('scale=100', 'scale='+newScale);
|
||||
$(element).attr('src', src);
|
||||
console.log("resized");
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
// Monitors //
|
||||
|
|
Loading…
Reference in New Issue