I'm currently using $_category->getImageUrl(); to return a category's image. How can I get a smaller thumbnail of the category image? I've tried $_category->getThumbnailUrl();, but that doesn't appear to work. It seems pretty easy to get a product thumbnail, but for some reason categories are a little trickier. Does anyone know how to get a smaller version of the category image?
Thanks in advance…
Best Answer
There is no native helper that produces thumbnail for category images. You need to create one for the category entity. To do that first create helper class in
Helper\Category\Image.php
Then you need to create
Model\Category\Image.php
with the following codeand finally model for configuration in
Model\Category\Media\Config.php
Now in the template file you can inject
Vendor\Extension\Helper\Category\Image
and resize category image using: