-
Notifications
You must be signed in to change notification settings - Fork 91
Closed
Labels
Milestone
Description
Description
Currently when the image is uploaded to the media gallery, the thumbnail is created for the image. The idea is to use a similar approach for generating the optimized version of the image.
- When image is uploaded to the media gallery the optimized version of the image should be created ("Rendition")
- Rendition should be created based on width/height specified in the configuration of MediaGalleryRenditions module
- If the image width is greater than the width specified in the configuration - the image should be resized to the configuration width
- If the image height is greater than the height specified in the configuration - the image should be resized to the configuration height
- The image should be resized proportionally
- Resized version of the image should be saved to the .renditions directory
- Image path/name should be generated using the same approach as thumbnail generation
(see\Magento\Cms\Model\Wysiwyg\Images\Storage::resizeFile
)
Implementation
- A
\Magento\MediaGalleryRenditionsApi\Api\GenerateRentitionsInterface
should be introduced with a single methodexecute(string $path): void
- An interface should be implemented by
\Magento\MediaGalleryRenditions\Model\GenerateRentitions
GenerateRentitionsInterface
should be used to execute rendition generation during the image upload