Skip to content

Commit

Permalink
[BUGFIX] Restore options to scale/crop images (#742)
Browse files Browse the repository at this point in the history
  • Loading branch information
twoldanski authored Jul 3, 2024
1 parent 3f6743f commit 428ab39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Classes/Utility/File/ProcessingConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class ProcessingConfiguration
public static function fromOptions(array $options): static
{
return new static(
(int)($options['width'] ?? 0),
(int)($options['height'] ?? 0),
(string)($options['width'] ?? ''),
(string)($options['height'] ?? ''),
(int)($options['minWidth'] ?? 0),
(int)($options['minHeight'] ?? 0),
(int)($options['maxWidth'] ?? 0),
Expand All @@ -52,8 +52,8 @@ public static function fromOptions(array $options): static
}

private function __construct(
public readonly int $width = 0,
public readonly int $height = 0,
public readonly string $width = '',
public readonly string $height = '',
public readonly int $minWidth = 0,
public readonly int $minHeight = 0,
public readonly int $maxWidth = 0,
Expand Down
4 changes: 2 additions & 2 deletions Classes/Utility/FileUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,8 @@ private function processAutogenerate(FileInterface $originalReference, FileInter
{
$originalWidth = $originalReference->getProperty('width');
$originalHeight = $originalReference->getProperty('height');
$targetWidth = $processingConfiguration->width > 0 ? $processingConfiguration->width : $fileReference->getProperty('width');
$targetHeight = $processingConfiguration->height > 0 ? $processingConfiguration->height : $fileReference->getProperty('height');
$targetWidth = (int)($processingConfiguration->width !== '' ? $processingConfiguration->width : $fileReference->getProperty('width'));
$targetHeight = (int)($processingConfiguration->height !== '' ? $processingConfiguration->height : $fileReference->getProperty('height'));

if ($targetWidth || $targetHeight) {
foreach ($processingConfiguration->autogenerate as $autogenerateKey => $conf) {
Expand Down

0 comments on commit 428ab39

Please sign in to comment.