Skip to content

Commit

Permalink
For custom layouts use a scale that gets us a width of 480px which is…
Browse files Browse the repository at this point in the history
… 25% of 1920.
  • Loading branch information
Isaac Connor committed May 25, 2024
1 parent 2aecef1 commit e716dca
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions web/skins/classic/views/montage.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@
$layout_id = $layoutsByName['Auto']->Id();
}
$layout = $layoutsById[$layout_id];
$layout_is_preset = array_search($layout->Name(), $presetLayoutsNames);

$layout_is_preset = array_search($layout->Name(), $presetLayoutsNames) === false ? false : true;

$options = array();

Expand Down Expand Up @@ -325,12 +324,19 @@
$monitor_options['state'] = !ZM_WEB_COMPACT_MONTAGE;
$monitor_options['zones'] = $showZones;
$monitor_options['mode'] = 'paused';
if (!$scale and ($layout->Name() != 'Auto') and (false !== $layout_is_preset)) {
if (preg_match('/^(\d+) Wide$/', $layout->Name(), $matches)) {
if ($matches[1]) {
$monitor_options['scale'] = intval(100*((1920/$matches[1])/$monitor->Width()));
if ($monitor_options['scale'] > 100) $monitor_options['scale'] = 100;
if (!$scale and ($layout->Name() != 'Auto')) {
if ($layout_is_preset) {
# We know the # of columns so can figure out a proper scale
if (preg_match('/^(\d+) Wide$/', $layout->Name(), $matches)) {
if ($matches[1]) {
$monitor_options['scale'] = intval(100*((1920/$matches[1])/$monitor->Width()));
if ($monitor_options['scale'] > 100) $monitor_options['scale'] = 100;
}
}
} else {
# Custom, default to 25% of 1920 for now, because 25% of a 4k is very different from 25% of 640px
$monitor_options['scale'] = intval(100*((1920/4)/$monitor->Width()));
if ($monitor_options['scale'] > 100) $monitor_options['scale'] = 100;
}
}
echo $monitor->getStreamHTML($monitor_options);
Expand Down

0 comments on commit e716dca

Please sign in to comment.