Hello,
I would like to be able to put some images in a grid-box and define a starting and ending column via select from the backend.
My current situation:
- <section class="work-set grid">
- <h3><perch:content id="heading" type="smarttext" label="Gruppenüberschrift" required="true" title="true"/></h3>
- <perch:blocks>
- <perch:block label="Bild" type="imagefigure">
- <figure class="work-entry <perch:content id="startcol" type="select" label="Startspalte" options="1|gs1, 2|gs2, 3|gs3, 4|gs4" allowempty="false" required> <perch:content id="endcol" type="select" label="Endspalte" options="1|ge1, 2|ge2, 3|ge3, 4|ge4" allowempty="false" required>">
- <img src="<perch:content id="image" type="image" label="Bild" required="true">"
- alt="<perch:content id="caption" type="smarttext" label="Bildunterschrift" editor="simplemde" required="true"/>">
- <figcaption><perch:content id="caption" type="smarttext" label="Bildunterschrift" editor="simplemde" required="true"/></figcaption>
- </figure>
- </perch:block>
- </perch:blocks>
- </section>
(The perch:blocks are for different content added later)
So far it works nicely.
To achieve optimal responsive image loading, I would like to use perch:if or something similar to take different paths based on the width of the image in columns.
Is it possible to get the raw values of the select fields, to calculate the width and use it to branch? (This would be my prefered way)
I tried to add another select field, where the user inputs the width himself and used it in perch:if. This works, but I don't know how to supress the output of the field and it's redundant.
Also if I branch out my pictures/srcsets like this, does Perch still manage to automatically create different image sizes based on the output size?
Bonus question: How would I retrieve the asset title to use in the caption?
Many thanks and greetings from Germany