0

In Magento 2.2, there is one command for product image to resize in different sizes.

php bin/magento catalog:image:resize

This command will read all image dimensions defined in the theme XML(view.xml) and re-generates the images in their respective cache folders(/pub/media/catalog/product/cache directory) to serve them from the cache on the storefront.

I want to extend this command bypassing the argument of product id or SKU.

php bin/magento catalog:image:resize --10

i.e. where 10 would be product id or SKU

I have gone through the file but not able to set product id or SKU in the following an object.

$this->productImage

Reading arguments via this link - Read Console Arguments

I came to know the same command going to remove from future releases and Magento has introduced an observer for the same. https://github.com/magento/magento2/blob/2.3/app/code/Magento/Catalog/Observer/ImageResizeAfterProductSave.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.