From 001e900c872a4aa1bea860414c4e426d06f8534d Mon Sep 17 00:00:00 2001 From: Rostislav Vitek Date: Wed, 8 Nov 2023 15:14:52 +0100 Subject: [PATCH 1/3] remove image sizes concept from backend - FE API: Image is now represented just by its URL and name (used for ALT attribute) - all FE API image-related tests rewritten to use queries/mutations defined in separate graphql files - SF: Image component no longer works with "type" prop (it was used for the image size definition :) - admin: image overview page removed - removed Front/ImageController with all the related routes --- src/Twig/ImageExtension.php | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/Twig/ImageExtension.php b/src/Twig/ImageExtension.php index 0873b4a945..0cfbbda1a0 100644 --- a/src/Twig/ImageExtension.php +++ b/src/Twig/ImageExtension.php @@ -31,21 +31,11 @@ public function getImageHtml($imageView, array $attributes = []): string $imageView->getExtension(), $entityName, $imageView->getType(), - $attributes['size'], - ); - - $additionalImagesData = $this->imageFacade->getAdditionalImagesDataFromAttributes( - $this->domain->getCurrentDomainConfig(), - $imageView->getId(), - $imageView->getExtension(), - $entityName, - $imageView->getType(), - $attributes['size'], ); $attributes['alt'] = $imageView->getName(); - return $this->getImageHtmlByEntityName($attributes, $entityName, $additionalImagesData); + return $this->getImageHtmlByEntityName($attributes, $entityName); } return parent::getImageHtml($imageView, $attributes); @@ -53,11 +43,10 @@ public function getImageHtml($imageView, array $attributes = []): string /** * @param \Shopsys\FrameworkBundle\Component\Image\Image|\Shopsys\ReadModelBundle\Image\ImageView|object $imageView - * @param string|null $sizeName * @param string|null $type * @return string */ - public function getImageUrl($imageView, $sizeName = null, $type = null) + public function getImageUrl($imageView, ?string $type = null): string { if ($imageView instanceof ImageView) { $entityName = $imageView->getEntityName(); @@ -68,10 +57,9 @@ public function getImageUrl($imageView, $sizeName = null, $type = null) $imageView->getExtension(), $entityName, $type, - $sizeName, ); } - return parent::getImageUrl($imageView, $sizeName, $type); + return parent::getImageUrl($imageView, $type); } } From 605f2c322e0cf74ba1ca2c7f5b15ebc872a35471 Mon Sep 17 00:00:00 2001 From: Rostislav Vitek Date: Wed, 8 Nov 2023 16:41:46 +0100 Subject: [PATCH 2/3] remove unused Twig image functions --- src/Twig/ImageExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Twig/ImageExtension.php b/src/Twig/ImageExtension.php index 0cfbbda1a0..956818bae9 100644 --- a/src/Twig/ImageExtension.php +++ b/src/Twig/ImageExtension.php @@ -46,7 +46,7 @@ public function getImageHtml($imageView, array $attributes = []): string * @param string|null $type * @return string */ - public function getImageUrl($imageView, ?string $type = null): string + protected function getImageUrl($imageView, ?string $type = null): string { if ($imageView instanceof ImageView) { $entityName = $imageView->getEntityName(); From 7a82dc7cd0810a8c4156ff28c19839288fd0ab7b Mon Sep 17 00:00:00 2001 From: Rostislav Vitek Date: Thu, 30 Nov 2023 12:15:41 +0100 Subject: [PATCH 3/3] remove unused lazy loading ability for Twig image function --- src/Resources/config/services.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Resources/config/services.yaml b/src/Resources/config/services.yaml index 53c7810e6f..f240370801 100644 --- a/src/Resources/config/services.yaml +++ b/src/Resources/config/services.yaml @@ -32,4 +32,3 @@ services: class: Shopsys\ReadModelBundle\Twig\ImageExtension arguments: $frontDesignImageUrlPrefix: '%shopsys.front_design_image_url_prefix%' - $isLazyLoadEnabled: '%shopsys.image.enable_lazy_load%'