Open in-session opened 3 years ago
Hi @in-session. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.
Please, add a comment to assign the issue: @magento I am working on this
It would be a simplification for everyone to implement something like this instead of using a helper for it every time. Also it would simplify some things with the cooperation of external modules, as an example, most modules for image compression or webp converting works on media folder base. Accordingly, static images are not converted, with this solution it would also be possible to insert images within the template.
Maybe as an idea:
<?= $this->getViewImageUrl('Magento_Theme::images/big.jpg'); ?>
https://www.domain.com/media/cache/{{Theme Path}}/Magento_Theme/images/big.jpg
<?= $this->getViewImageUrlAndResize('Magento_Theme::images','50','50','big.jpg'); ?>
https://www.domain.com/media/cache/{{Theme Path}}/Magento_Theme/images/resized/big-50x50.jpg
https://www.domain.com/media/cache/{{Theme Path}}/{{Modul}}/{{path}}/resized/big-{{size}}.jpg
In this case the images would be cloned or resized from themfolder to media. This would have significant advantages, the images always refer to the respective store and the original image is not changed.
Similarly it would go for all other modules as well as external modules:
<?= $this->getViewImageUrlAndResize('Vendor_Modul::images','50','50','big.jpg'); ?>
https://www.domain.com/media/cache/{{Theme Path}}/'Vendor_Modul/images/resized/big-50x50.jpg
Critical images that should remain in static can still be accessed and are excluded from it
<?= $this->getViewFileUrl('Magento_Theme::images/big.jpg'); ?>
You could clear the images using cache via admin, maybe additionally with a dropdown for selecting the store:
Here was once an approach to this:
Similar approach:
Hello together,
it is really a tiresome topic to reduce images in template or modules to a certain size. There are countless helpers that would not be necessary if this was already in the core.
As a rough example
Thus it would be at least possible to reduce the images on each module simply