Forum

Thread tagged as: Question

Page attributes in navigation - Image size

Hi,

I've created the following page attribute:

attributes/thumbnail.html

<perch:pages type="image" id="casestudy_thumb" label="Thumbnail" width="250" height="250" crop="true" suppress="true" divider-before="Case Study Thumbnail" />

I've then added this attribute to a custom navigation:

navigation/casestudies.html

<a href="<perch:pages id="pagePath" />"><img src="<perch:pages id="casestudy_thumb" encode="false" />" alt=" " /> <perch:pages id="pageNavText" /></a>

The image is displayed but at full size, not the cropped size set in the page attribute 250x250px. Can I change this?

Many thanks Michael

Michael Grinstead

Michael Grinstead 0 points

  • 6 years ago

Hello Michael

I’ve done something similar, try using:

<a href="<perch:pages id="pagePath" />"><img src="<perch:pages type="image" id="casestudy_thumb" width="250" height="250" crop="true" />" alt=" " /> <perch:pages id="pageNavText" /></a>

You might only need the width and not the height and crop too, but using them all should make sure it matches.

Hope that helps

Nick

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's it - the sizing options need to match so that Perch can find the right version of the image.

Thank you Nick & Drew, that did the trick.

Michael