Forum

Thread tagged as: Question

Example image syntax

Hello,

I have found the image entry in the documentation. It refers to many different capabilities, however does not provide examples showing the syntax for the more advanced features (eg. crop). Could you please provide an example.

Tony Astley

Tony Astley 0 points

  • 4 years ago

As stated on the docs located here: https://docs.grabaperch.com/templates/field-types/image/ - crop is a boolean value, i.e. true or false. So you can add it to images like so:

<perch:content id="logo" type="image" width="600" height="600" crop="true" label="Logo" />

OK, I had read that, but it leaves a few unanswered questions.

Is it possible to resize and crop?

Is it possible to crop without resizing?

Is it possible to control the origin point of the crop (top left, centre, centre)?

Does your syntax resize an image then crop it? Or simply crop it to the provided dimensions.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Is it possible to resize and crop?

Yes, specifying dimensions and crop will resize and crop.

Is it possible to crop without resizing?

It's not, no.

Is it possible to control the origin point of the crop (top left, centre, centre)?

Not currently - it's always the centre.

Does your syntax resize an image then crop it? Or simply crop it to the provided dimensions.

It resizes to fit a bounding box and then crops the excess.

Cheers Drew. Thanks for that.