Forum

Thread tagged as: Question, Addons, Gallery

Image resizing in Gallery

I cannot seem to get my images to resize correctly. i have various original sizes and so want on album listing the images to all be a fixed height and then resized to the correct width not cropped.

I have been tweaking the example d template and the image.html template but nothing seems to work.

d_album-image.html

<li class="album">
        <perch:if exists="small"><a href="album.php?s=<perch:gallery id="albumSlug" />"><img src="<perch:gallery id="small" />" height="200px" crop="true" supress="true" quality="100" alt="<perch:gallery id="imageAlt" />"   /> </a></perch:if>
        <div><a href="album.php?s=<perch:gallery id="albumSlug" />"><perch:gallery id="albumTitle" /></a></div>
    </li>

image.html

<perch:gallery id="image" type="image" key="small" height="200" crop="true" />
<perch:gallery id="image" type="image" key="main"  width="640" height="480" />
<perch:gallery id="image" type="image" key="thumb" width="30" height="30" crop="true" />

<perch:gallery id="desc" type="textarea" label="Description" size="s" textile="true" editor="markitup" />
Denise Courtney

Denise Courtney 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

If you only want to constrain by height, don't set a width value.

I am working on the 'small' and as you can see from above I have no widths.Whatever height I set it always seems to square it and make width the same.

Drew McLellan

Drew McLellan 2638 points
Perch Support

What are you expecting the crop attribute to do in that case?

Sorry to come bcd to this but been off work...

I have removed the crop but still doesn't do what I want.

If you take a look at my page https://nickoakleyphotography.com/gallery/ As the album images are square and the same size. I would like the height set on each but the width to vary proportionately with the size of the original image without any distortion..

Is there another setting somewhere else as the width seems to automatically equal the height I set rather than a ratio of it?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, so set the height only, and not the width. You should never get any distortion, whatever your settings.

I have this on my template...

<li class="album">
        <perch:if exists="small"><a href="album.php?s=<perch:gallery id="albumSlug" />"><img src="<perch:gallery id="small" />" height="200px" quality="100" alt="<perch:gallery id="imageAlt" />"   /> </a></perch:if>
        <div><a href="album.php?s=<perch:gallery id="albumSlug" />"><perch:gallery id="albumTitle" /></a></div>
    </li>

Aa you scan see no width, but whatever I change the height to the width is made the same.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You're not setting any dimensions on the Perch tags at all.

No but I think I have found the error and need to reload the images. Ill give it a go.