3

I have getting issue of white space on product detail page.

I tried to fixed using view.xml but no success.

enter image description here

I have added image to show where I am getting white space.

2
  • Getting error: > etc/view.xml" is invalid: Element 'frame': This element is not > expected. Expected is ( background ). Line: 59 Verify the XML and try > again.
    – Flynryder
    Aug 20 '19 at 5:20
  • not getting any kind of error I have already checked it. Aug 20 '19 at 6:33
2

In your view.xml set "width" and "height" as you wish and then "transparency" , "aspect_ratio" and "frame" to "false"

Example:

<?xml version="1.0"?>
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/view.xsd">
    <media>
        <images module="Magento_Catalog">
            <image id="category_page_list" type="small_image">
                <width>240</width>
                <height>300</height>
                <transparency>false</transparency>
                <aspect_ratio>false</aspect_ratio>
                <frame>false</frame>
            </image>
        </images>
    </media>
</view>
4
  • I have already tried this solution but no luck. Mar 18 '19 at 7:22
  • Run all commands upgrade,indexing,caching,deploy
    – Rk Rathod
    Mar 18 '19 at 7:37
  • I have already done that all and but the thing is I want to remove that white space from product detail page not from product listing page. Mar 18 '19 at 7:38
  • You can use the below code. It worked for me on magento 2.2.11 <image id="product_page_image_large" type="image"> <transparency>false</transparency> <aspect_ratio>true</aspect_ratio> <frame>false</frame> </image>
    – Mohammed
    May 8 '20 at 12:10
0

its working on product list and Detail Page i have used

 <transparency>false</transparency>
 <aspect_ratio>false</aspect_ratio>
 <frame>false</frame>

this is before image this is before image

this is after image this is after image

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.