![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/app/code/Staempfli/ImageResizer/ |
# Magento 2 Image Resizer Magento 2 Module to add simple image resizing capabilities in all blocks and .phtml templates ## Installation ``` $ composer require "staempfli/magento2-module-image-resizer":"~2.0" ``` ## Usage `imageResizer` is automatically available in all frontend Blocks. You can resize your images just calling a method: ```php /** @var \Staempfli\ImageResizer\Model\Resizer $imageResizer */ $imageResizer = $block->getImageResizer(); $resizedImageUrl = $imageResizer->resizeAndGetUrl(<originalImageUrl>, $width, $height, [$resizeSettings]); ``` You can do that directly on the .phtml or in your custom Block. ## Cache Resized images are saved in cache to improve performance. That way, if an image was already resized, we just use the one in cache. If you need to, you can clear the resized images cache on the Admin Cache Management  ## Prerequisites - PHP >= 7.0.* - Magento >= 2.1.*