Forum

Thread tagged as: Question, Problem

Image Resizing in Perch

Hi,

According to the documentation Perch can resize or crop images on upload (https://docs.grabaperch.com/perch/content/templates/upload-one-image-generate-many-sizes/). I am running Perch v3.0.14 and I have tried to specify a particular size for an image using the following code in a template:

<img src="<perch:content id="service_image" type="image" label="Service Image" />" alt="<perch:content type="text" id="service_name" />" class="img-responsive visible-xs hidden-sm hidden-md hidden-lg" />

<img src="<perch:content id="service_image" type="image" label="Service Image" crop width="768" height="350" suppress />" alt="<perch:content type="text" id="service_name" />" class="img-responsive hidden-xs visible-sm visible-md visible-lg" />

I'm uploading a square image (1200px X 1200px). The image is uploaded to perch/resources/ with '-w768h350' added to the filename however the image is not cropped to this size or proportions, it remains square. Why is this and what is the correct code to instruct Perch to crop the image to the size I've requested?

Chris Jones

Chris Jones 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

If you're running an old version of Perch, you need to use old template syntax to match.

Change crop to crop="true".

Or simpler, update to the current version.