diff --git a/src/lib/Imagine/FocusedImageAliasGenerator.php b/src/lib/Imagine/FocusedImageAliasGenerator.php index 896ade3..dbdc90e 100644 --- a/src/lib/Imagine/FocusedImageAliasGenerator.php +++ b/src/lib/Imagine/FocusedImageAliasGenerator.php @@ -95,6 +95,19 @@ protected function getFocusPoint(\Ibexa\Core\FieldType\Value $fieldValue, string return null; } + protected function isFocusedThumbnail(string $variationName): bool + { + $variationConfig = $this->filterConfiguration->get($variationName); + if (isset($variationConfig['filters']['focusedThumbnail'])) { + return true; + } + if ($variationConfig['reference']) { + return $this->isFocusedThumbnail($variationConfig['reference']); + } + + return false; + } + /** * {@inheritdoc} * @@ -114,8 +127,7 @@ public function getVariation(Field $field, VersionInfo $versionInfo, $variationN $focusPoint = $this->getFocusPoint($field->value, $variationName); if (IORepositoryResolver::VARIATION_ORIGINAL !== $variationName) { - $variationConfig = $this->filterConfiguration->get($variationName); - if (isset($variationConfig['filters']['focusedThumbnail'])) { + if ($this->isFocusedThumbnail($variationName)) { $parameters = [ 'filters' => [ 'focusedThumbnail' => [ diff --git a/src/lib/Imagine/ImageAliasGenerator.php b/src/lib/Imagine/ImageAliasGenerator.php index 8e3359b..fb9a18b 100644 --- a/src/lib/Imagine/ImageAliasGenerator.php +++ b/src/lib/Imagine/ImageAliasGenerator.php @@ -175,10 +175,13 @@ private function applyFilter(BinaryInterface $image, string $variationName, arra isset($filterConfig['reference']) && IORepositoryResolver::VARIATION_ORIGINAL !== $filterConfig['reference'] ) { - unset($runtimeFiltersConfig['filters']); $image = $this->applyFilter($image, $filterConfig['reference'], $runtimeFiltersConfig); } + if (!isset($filterConfig['filters']['focusedThumbnail'])) { + unset($runtimeFiltersConfig['filters']['focusedThumbnail']); + } + return $this->filterManager->applyFilter($image, $variationName, $runtimeFiltersConfig); }