Forum

Thread tagged as: Problem

Crop not cropping

I have a repeater field that contains 2 image sizes:

<perch:block type="gallery" label="Gallery">
        <perch:repeater id="gallery-repeater">
            <perch:before>
                <section class="Gallery">
            </perch:before>
            <!--* Gallery image sizes 1200w, 400x400 *-->
            <perch:content id="gallery-image" type="image" width="1200" quality="49" label="Image" suppress="true" />
            <perch:content id="gallery-image" type="image" width="400" height="400" crop="true" quality="49" label="Image" suppress="true" />
            <a href='<perch:content id="gallery-image" type="image" width="1200"/>' class="Gallery__item" <perch:if exists="gallery-item-desc">title='<perch:content id="gallery-item-desc" type="text" label="Item description" help="Fill this in! It's useful for SEO"/>'</perch:if>>
                <div class="Gallery__image">
                    <img src='<perch:content id="gallery-image" type="image" width="400" height="400" />' <perch:if exists="gallery-item-desc">alt='<perch:content id="gallery-item-desc" type="text" label="Item description"/>'</perch:if> >
                </div>
                <perch:if exists="gallery-item-desc">
                    <div class="Gallery__item-desc">
                        <p><perch:content id="gallery-item-desc" type="text" label="Item description" /></p>
                    </div>
                </perch:if>
            </a>
            <perch:after>
                </section>
            </perch:after>
        </perch:repeater>
    </perch:block>

However, when I upload an image, the square version isn't cropped to square, it keeps its aspect ratio with a width of 400, even though the file is named dsc3003-w400h400.jpg

Any ideas?

Thanks!

Adam Menczykowski

Adam Menczykowski 1 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

How big is the source image?

1400 x 394 is an example size, all are about that size roughly.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Does it make a difference if the tag IDs only contain valid characters?

Just changed the id from gallery-image to galleryimage

That fixed it! Thanks Drew

The docs state: Use letters, numbers and underscores only for an id. Didn't realise that!