Question

I have changed the below section of my custom themes' view.xml

<image id="product_page_main_image_default" type="image">
    <width>1200</width>
    <height>1552</height>
</image>

After that when I go to the product detail page image sizes are showing for the previous size only. I run the php bin/magento catalog:images:resize it taking lot of time.

Is there any way to run the command for the specific change only.

No correct solution

OTHER TIPS

I ran into the same problem not so long ago.

php bin/magento catalog:images:resize 

Will take way too long to run. Instead, if you are in Developer mode, Find in Code Folder:

Pub > Media > Catalog > Product > Cache

Delete this entire 'Cache' folder.

Then go back onto the Frontend of website, refresh and the image is regenerated with correct sizes.

In production, there is no need to delete the Cache folder, these will be regenerated once it's detected the change inside view.xml file, and then cache them after first time a user has hit the page.

In addition to the above, If testing on a local or development environment, make sure that the URL of the images are pointing to the correct localhost or development domain. These are defined in:

App > Etc > env.php

Find the part which says 'base_media_url' Check that it is correct for both secure and unsecure.

Hope this helps

I suggest you follow these steps:

Step 1: Find file view.xml

  • It's usually in <theme_dir>/etc/view.xml.

Step 2: Find the id and image that need changes

  • Each product image in Magento has its own id and type attribution. They are defined in tag in view.xml file.
  • In your case, the image id is:

Step 3: Change the width and height

Step 4: Clear cache and run php bin/magento catalog:images:resize

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top