Skip to content

Commit

Permalink
Merge pull request #1692 from bolt/bugfix/thumbnail-one-dimension
Browse files Browse the repository at this point in the history
Thumbnailing works with only width or only height
  • Loading branch information
bobdenotter authored Aug 7, 2020
2 parents 96e73c3 + 265b2b4 commit 9e4ed54
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Utils/ThumbnailHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ public function __construct(?Config $config = null)

public function parameters(?int $width = null, ?int $height = null, ?string $location = null, ?string $path = null, ?string $fit = null): string
{
if (! $width) {
if (! $width && ! $height) {
$width = $this->config->get('general/thumbnails/default_thumbnail/0', 320);
}
if (! $height) {
$height = $this->config->get('general/thumbnails/default_thumbnail/1', 240);
} elseif (! $width) {
// If no width, let it be ridiculously high, so that it crops based on height
$width = 10000;
} elseif (! $height) {
// If no height, let it be ridiculously high, so that it crops based on width
$height = 10000;
}

$paramString = sprintf('%s×%s', $width, $height);
Expand Down

0 comments on commit 9e4ed54

Please sign in to comment.