Hello,
We have a set of content fragment templates with content reference fields that allow you to select images.
Sample config:
<imageField jcr:primaryType="nt:unstructured" sling:resourceType="dam/cfm/models/editor/components/contentreference"
fieldLabel="Image"
listOrder="21"
filter="hierarchy"
metaType="reference"
name="imageRef_image"
nameSuffix="contentReference"
renderReadOnly="false"
showEmptyInReadOnly="true"
valueType="string"/>
When interacting with this field, I can select the image just fine, but is there a way to select one of the image renditions (located at IMAGE/jcr:content/renditions/)? For some background, we have a servlet that returns content fragments as JSON. The image field on this response ends up being a reference to the original image, but we are trying to figure out a way to reference a particular resolution/rendition of the original.
Interesting enough, if I select an image in the content reference field, and then add /jcr:content/renditions to the text field, the reference window will then show some of those available renditions. Just trying to figure out how to expose these by default.
Thanks.
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hello,
I don't think OOTB it is possible. Now couple of thing you can do
1. if you deciding to root for image selection where the images renditions are a set and predefined, then you can create another drop down field (using that predefined set values) after image to select available available renditions. Now that data will be available in JSON to end application. at application side you can create the path through code like if the rendition drop down selected as 140x100 then through code you can create rendition path as "jcr:content/renditions/cq5dam.thumbnail.140.100.png" and suffixing to the image path. only maintenance would be managing the drop down if the rendition sizes change.
2. otherwise, you can write your own custom listener to prefetch available renditions under given image path and auto populate rest of the value as the author type. this would be more tricky as the list of renditions will grow
Hope this helps!!
here is a similar thread
See if that works for you,
Checked the component
/libs/dam/cfm/models/editor/components/contentreference
It comes under internal area so overlaying this component and making changes in it ..can not do this
if above solution does not works out, see if you could write any jquery code for that dialog and try to add "/jcr:content/renditions". As you told it worked for you . But this might not be the correct way,just a thought.
Hello,
I don't think OOTB it is possible. Now couple of thing you can do
1. if you deciding to root for image selection where the images renditions are a set and predefined, then you can create another drop down field (using that predefined set values) after image to select available available renditions. Now that data will be available in JSON to end application. at application side you can create the path through code like if the rendition drop down selected as 140x100 then through code you can create rendition path as "jcr:content/renditions/cq5dam.thumbnail.140.100.png" and suffixing to the image path. only maintenance would be managing the drop down if the rendition sizes change.
2. otherwise, you can write your own custom listener to prefetch available renditions under given image path and auto populate rest of the value as the author type. this would be more tricky as the list of renditions will grow
Hope this helps!!
Views
Likes
Replies