Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Is it possible to search for a rendition of an image based on the dimensions via QueryBuilder API

Avatar

Avatar
Level 1
RobertoPrimo
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
RobertoPrimo
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

0 solutions
View profile
RobertoPrimo
Level 1

27-03-2020

Hi all,

 

What I would like to achieve is the following. Based on the specified dimension and an asset title I would like to find all the asset renditions which correspond to the search criteria. 

Currently I am using the QueryBuilder API as I am not working in Java but it seems impossible that in just one call to the AEM I manage to get the wanted rendition.

 

What would be the best way for search the image renditions?

Looking forward to your ideas!

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Ignite 5
Employee
davidjgonzalezz
Employee

Likes

35 likes

Total Posts

52 posts

Correct Reply

15 solutions
Top badges earned
Ignite 5
Ignite 3
Ignite 1
Give Back 3
Give Back
View profile

Avatar
Ignite 5
Employee
davidjgonzalezz
Employee

Likes

35 likes

Total Posts

52 posts

Correct Reply

15 solutions
Top badges earned
Ignite 5
Ignite 3
Ignite 1
Give Back 3
Give Back
View profile
davidjgonzalezz
Employee

20-10-2020

You cannot do this OOTB since rendition dimensions are not sorted as properties.

 

Technically could search for rendition nt:files, create a custom QueryBuilderFiltering predicate that pulls them into memory and determines their size and filters them in/out - but needless to say this would be very very bad for performance -- so don't do this!

 

Instead, I suggest creating a WF Process (assuming 6.x) that determines and writes rendition sizes as JCR Properties that you can then search over. There are main places you could put this data:

1) on the rendition [dam:Asset]/renditions/[nt:file]/[oak:resource] node - however this would require a custom mixin to allow you to put these custom properties - however you could apply them on each discrete rendition node.

2) under [dam:Asset]/metadata in some structure that holds the rendition dimensions, along w/ the rendition name.

 

Then make sure these new properties are indexed - and then use query builder to query on these derived rendition size properties.

Answers (0)