How can I resize the images rendered via the recently viewed product widget?

I have tried editing multiple values inside


but none updated the recently viewed image sizes.

They are currently rendering at 135px in height and width, the only values set at 135 is shared_wishlist_email and product_small_image. Neither of those changed the image size.

3 Answers 3


I have done something similarly but for the img on the product page. What I did: I changed the block that load my img.

In my di.xml:

 <type name="Magento\Catalog\Block\Product\View\Gallery">
        <plugin name="plugin_block_catalog_product_view_gallery"

and i rewrite this block by changing the path of the img like this :

public function getGalleryImagesJson()
        $product = $this->getProduct();
        $imagesItems = [];
        foreach ($this->getGalleryImages() as $image) {

            $imagesItems[] = [
                'thumb' => $this->getBaseUrl().'pub/media/catalog/product/'.$image['file'],
                'img' => $this->getBaseUrl().'pub/media/catalog/product/'.$image['file'],
                'full' => $this->getBaseUrl().'pub/media/catalog/product/'.$image['file'],
                'caption' => $image->getLabel(),
                'position' => $image->getPosition(),
                'isMain' => $this->isMainImage($image),
        if (empty($imagesItems)) {
            $imagesItems[] = [
                'thumb' => $this->_imageHelper->getDefaultPlaceholderUrl('thumbnail'),
                'img' => $this->_imageHelper->getDefaultPlaceholderUrl('image'),
                'full' => $this->_imageHelper->getDefaultPlaceholderUrl('image'),
                'caption' => '',
                'position' => '0',
                'isMain' => true,
        return json_encode($imagesItems);

I know is not what you need, but this may help you.


Use this in your view.xml:

<image id="recently_compared_products_images_only_widget" type="thumbnail">

Based on Sajid Iqbal Answer - In Magento 2.4.3 / 2.4.4 you can use this.


<image id="recently_viewed_products_images_names_widget" type="thumbnail">

Reference: vendor/magento/module-catalog/view/frontend/templates/product/widget/viewed/sidebar.phtml

'image' => [
        'imageCode' => 'recently_viewed_products_images_names_widget'

After your modification you must run: bin/magento s:upgrade

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.