Fix width and height not persisting. Check for valid value instead of validInt because we have px on the end. Clear cookie if not valid

pull/4202/head
Isaac Connor 2024-12-12 13:05:22 -05:00
parent 1922eaacdf
commit c2b64364a6
1 changed files with 14 additions and 6 deletions

View File

@ -76,20 +76,28 @@ if ( isset($_COOKIE['zmMontageLayout']) ) {
$options = array();
$options['width'] = 'auto';
if ( isset($_COOKIE['zmMontageWidth']) ) {
$_SESSION['zmMontageWidth'] = $options['width'] = validInt($_COOKIE['zmMontageWidth']);
if (isset($widths[$_COOKIE['zmMontageWidth']])) {
$_SESSION['zmMontageWidth'] = $options['width'] = $_COOKIE['zmMontageWidth'];
} else {
unset($_COOKIE['zmMontageWidth']);
zm_setcookie('zmMontageWidth', 'auto');
}
#} elseif ( isset($_SESSION['zmMontageWidth']) and $_SESSION['zmMontageWidth'] ) {
#$options['width'] = $_SESSION['zmMontageWidth'];
} else {
$options['width'] = 0;
}
$options['height'] = 'auto';
if ( isset($_COOKIE['zmMontageHeight']) ) {
$_SESSION['zmMontageHeight'] = $options['height'] = validInt($_COOKIE['zmMontageHeight']);
if (isset($heights[$_COOKIE['zmMontageHeight']])) {
$_SESSION['zmMontageHeight'] = $options['height'] = $_COOKIE['zmMontageHeight'];
} else {
unset($_COOKIE['zmMontageHeight']);
zm_setcookie('zmMontageHeight', 'auto');
}
#else if ( isset($_SESSION['zmMontageHeight']) and $_SESSION['zmMontageHeight'] )
#$options['height'] = $_SESSION['zmMontageHeight'];
} else {
$options['height'] = 0;
}
$scale = '100'; # actual