I have inserted the image into the product and check then product coming with the white background.How to remove this white background and display image small ?
-
Can't you achieve this with css? like extend the product page style in your custom theme?– KorbinCommented Jul 30, 2019 at 6:23
-
1This is a image not a content– Hardik MakwanaCommented Jul 30, 2019 at 6:30
-
tried this Answer ?– PiyushCommented Jul 30, 2019 at 6:31
-
Hello @Piyush, This is for a category page. Not for a product detail page– Hardik MakwanaCommented Jul 30, 2019 at 6:34
-
1Not working bro, I have checked– Hardik MakwanaCommented Jul 30, 2019 at 6:58
|
Show 1 more comment
1 Answer
One of the possible solution, In etc/view.xml
of your current theme, you can update product image size
Make sure you resize with the expect ratio.
Use additional tag <frame>
to prevent white borders on image. Use this code as example:
<image id="product_page_main_image" type="small_image">
<width>460</width>
<height>460</height>
<aspect_ratio>true</aspect_ratio>
<frame>false</frame>
</image>
After changes run:
php bin/magento catalog:images:resize
php -dmemory_limit=1G bin/magento setup:static-content:deploy -f
php bin/magento cache:clean
php bin/magento cache:flush
-
1Hello, After changes it is required to run php bin/magento catalog:images:resize command ? Commented Jul 30, 2019 at 6:42
-
Yes, also run these commands as well
php -dmemory_limit=1G bin/magento setup:static-content:deploy -f
php bin/magento cache:clean
php bin/magento cache:flush
Commented Jul 30, 2019 at 6:47 -
@MuhammadHasham, I have edited please remove comments dear. and your solution seems worked Commented Jul 30, 2019 at 7:27
-
1