4

I am having a problem with how my images are displaying on my Magento 2 store.

And also I would like to know:

What does catalog:images:resize in Magento 2.x version ?

  • Are you asking of php bin/magento catalog:images:resize – Arjun Aug 10 '16 at 7:25
  • Yes i am asking in regards to php bin/magento catalog:images:resize – Jiyaad.D Aug 10 '16 at 7:35
5

The images size is defined in view.xml of <theme_dir>/etc/view.xml. You can also manually modify according to your requirement. For eg:

<images module="Magento_Catalog">
    <image id="unique_image_id" type="image">
        <width>100</width> <!-- Image width in px --> 
        <height>100</height> <!-- Image height in px -->
    </image>
</images>

But, if you have following conditions:

 1. If you imported products which might have variable sized images
 2. If images were resized or deleted manually from cache

The magento catalog:images:resize command enables you to resize images for display on your storefront.

I hope this helps you !!

  • is it a good idea to modify this file? – Jiyaad.D Aug 11 '16 at 7:23
  • YES. You can. Copy view.xml of parent theme and paste to your theme with same folder directory. Now you can change view.xml of your theme as per your requirement. – sagar sapkota Aug 11 '16 at 8:26
2

Generally, product images are cached while saving the product from admin panel. However, sometimes you may need to re-create the product images cache after you import products, if images were resized manually in the cache, or if the cache was manually cleared by mistake.

Command usage:

php <magento install dir>/bin/magento catalog:images:resize

This command takes no arguments or options.

The message Product images resized successfully. displays to confirm the command succeeded.

Source: http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/themes/theme-images.html#resize-catalog-images

1

php bin/magento catalog:images:resize

It creates resized product images.

Your Answer

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

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