https://github.com/staempfli/magento2-module-image-resizer
Magento 2 Module to add simple image resizing capabilities in all blocks and .phtml templates
https://github.com/staempfli/magento2-module-image-resizer
image-resizer magento2 magento2-extension
Last synced: about 2 months ago
JSON representation
Magento 2 Module to add simple image resizing capabilities in all blocks and .phtml templates
- Host: GitHub
- URL: https://github.com/staempfli/magento2-module-image-resizer
- Owner: staempfli
- Created: 2016-10-07T13:12:18.000Z (over 8 years ago)
- Default Branch: develop
- Last Pushed: 2020-10-01T15:18:02.000Z (almost 5 years ago)
- Last Synced: 2025-04-27T01:47:16.418Z (2 months ago)
- Topics: image-resizer, magento2, magento2-extension
- Language: PHP
- Homepage:
- Size: 233 KB
- Stars: 93
- Watchers: 8
- Forks: 33
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Magento 2 Image Resizer
[](http://www.repostatus.org/#abandoned)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(, $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.*