diff --git a/lib/Controller/Schedule.php b/lib/Controller/Schedule.php index fc2d3c9e96..5f8bf26215 100644 --- a/lib/Controller/Schedule.php +++ b/lib/Controller/Schedule.php @@ -1,8 +1,8 @@ session->get('displayGroupIds'); + + if (!is_array($displayGroupIds)) { + $displayGroupIds = []; + } + $displayGroups = []; if (count($displayGroupIds) > 0) { foreach ($displayGroupIds as $displayGroupId) { - if ($displayGroupId == -1) + if ($displayGroupId == -1) { continue; + } - $displayGroup = $this->displayGroupFactory->getById($displayGroupId); + try { + $displayGroup = $this->displayGroupFactory->getById($displayGroupId); - if ($this->getUser()->checkViewable($displayGroup)) { - $displayGroups[] = $displayGroup; + if ($this->getUser()->checkViewable($displayGroup)) { + $displayGroups[] = $displayGroup; + } + } catch (NotFoundException $e) { + $this->getLog()->debug( + sprintf( + 'Saved filter option for displayGroupId %d that no longer exists.', + $displayGroupId + ) + ); } } } diff --git a/lib/Widget/Image.php b/lib/Widget/Image.php index d3aa443cea..7f3c2a0584 100644 --- a/lib/Widget/Image.php +++ b/lib/Widget/Image.php @@ -1,6 +1,6 @@ getCheckbox('fit') === 1; + // only use upsize constraint, if we the requested dimensions are larger than resize limit. + $resizeLimit = $this->getConfig()->getSetting('DEFAULT_RESIZE_LIMIT', 6000); + $useUpsizeConstraint = max($width, $height) > $resizeLimit; + $this->getLog()->debug('Whole file: ' . $filePath . ' requested with Width and Height ' . $width . ' x ' . $height . ', proportional: ' . var_export($proportional, true) - . ', fit: ' . var_export($fit, true)); + . ', fit: ' . var_export($fit, true) + . ', upsizeConstraint ' . var_export($useUpsizeConstraint, true)); $img = Img::make($filePath); @@ -282,11 +287,13 @@ public function download(Request $request, Response $response): Response if ($fit) { $img->fit($width, $height); } else { - $img->resize($width, $height, function ($constraint) use ($proportional) { + $img->resize($width, $height, function ($constraint) use ($proportional, $useUpsizeConstraint) { if ($proportional) { $constraint->aspectRatio(); } - $constraint->upsize(); + if ($useUpsizeConstraint) { + $constraint->upsize(); + } }); } }