I have created customize theme which extends to magento blank. I am using widget to show latest products in home page.
Now, My page look like this
I want to resize the every image (catalog product list) in widget. I will expect my page look like this
Note : I could refer this link to change all image size but no luck. copy view.xml from blank theme, paste into app/design/..../mytheme/etc/view.xml. I change below content in view.xml
<image id="category_page_grid" type="small_image">
<width>400</width>
<height>400</height>
</image>
<image id="category_page_list" type="small_image">
<width>400</width>
<height>400</height>
</image>
but nothing get reflected
here I put two questions
How to resize individual image in product list
Why mytheme view.xml get not reflected
1 Answer 1
1) you can define any new image type in the view.xml. To use it you have to pass the image id to the image helper used like here for example: https://github.com/magento/magento2/blob/develop/app/code/Magento/Catalog/Block/Product/View/Gallery.php#L60
2) if I got the right widget here, you have to override a differrent image id:
So you would have to override these images in your view.xml:
grid: https://github.com/magento/magento2/blob/develop/app/design/frontend/Magento/blank/etc/view.xml#L55
list: https://github.com/magento/magento2/blob/develop/app/design/frontend/Magento/blank/etc/view.xml#L59
-
Thanks for the reply. Give me sometime I am working with your answer. after while I come back to you.Bilal Usean– Bilal Usean2016年03月16日 18:10:37 +00:00Commented Mar 16, 2016 at 18:10
-
Wow great geneious, its working. you have given right answer to second question. I up vote you. I have one doubt, how you find image id for appropriate taskBilal Usean– Bilal Usean2016年03月16日 18:25:46 +00:00Commented Mar 16, 2016 at 18:25
-
You have to locate the template or Block file to see which image definition is used. Currently, many core features rely on having the related images defined in your view.xml. I hope this will be more flexible in the future. Some images are hardcoded in the Core Modules and if they are not defined in the view.xml you will get an errorDavid Verholen– David Verholen2016年03月16日 18:28:53 +00:00Commented Mar 16, 2016 at 18:28
-
I can't get clear, image definition? . In temlate file only mention the classBilal Usean– Bilal Usean2016年03月16日 18:33:58 +00:00Commented Mar 16, 2016 at 18:33
-
i updated the answer. The Product Gallery for example creates the images in the block. The Image Helper can create resized images for you by passing the image id defined in your view.xml like here: github.com/magento/magento2/blob/develop/app/code/Magento/…David Verholen– David Verholen2016年03月16日 18:36:43 +00:00Commented Mar 16, 2016 at 18:36