Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Query or report showing byte-lengths and pixel-sizes of All image renditions in Digital Assets

Avatar

Level 4

Hi All,

Is it possible in AEM 6.1 to see a list showing byte-lengths and pixel-sizes of All image renditions in Digital Assets?

Is there a query or report built in to AEM 6.1 that can do this?   Or is it possible to do this in JAVA?

In CRXDE Lite, the following SQL2 query will list all files in Digital Assets, but includes files which are not images :-

    SELECT * FROM [dam:Asset] WHERE ISDESCENDANTNODE("/content/dam")

But the following SQL2 quary returns no results :-

    SELECT * FROM [dam:Asset] AS d WHERE d.[jcr:content/renditions] IS NOT NULL

Alternatively the URL http://localhost:4522/bin/querybuilder.json?path=%2fcontent%2fdam&p.limit=-1 does return a lot of data in JSON format but at the bottom of the data it says Exception: StackOverflowError.

Thank you for your time.

1 Accepted Solution

Avatar

Correct answer by
Administrator

The image details are stored under metadata/dam:size property . 

For extending search , you need to create a custom facet to search dam based on asset size . 

1. What is the best approach to create a custom facet ? 

I try overlaying /libs/cq/ui/widgets/source/widgets/wcm/PropertyPredicate.js and customized the Propertypredicate.js javascript as per your requirement .

2.Now ,you need to create JCR Predicate expression to genarate XPATH query . Please find a sample predicate expression 

http://localhost:4502/libs/cq/search/content/querydebug.html 

type=dam:Asset
property=jcr:content/metadata/dam:size
property.value = 42018

How to add operators to the predicate expression to generate below XPATH

//element(*, dam:Asset)
[
jcr:content/metadata/@dam:size<42018 
]

I Hope this will work for you.

~kautuk



Kautuk Sahni

View solution in original post

2 Replies

Avatar

Level 10

You would have to write a custom service to do this. You would need to query for the DAM assets using JCR SQL2 or QUeryBuilder then write Java logic to get at the byte information that you want. AEM does not support this out of the box. 

See - this will point you in the right direction:

http://stackoverflow.com/questions/9551900/how-to-get-image-real-byte-size

Avatar

Correct answer by
Administrator

The image details are stored under metadata/dam:size property . 

For extending search , you need to create a custom facet to search dam based on asset size . 

1. What is the best approach to create a custom facet ? 

I try overlaying /libs/cq/ui/widgets/source/widgets/wcm/PropertyPredicate.js and customized the Propertypredicate.js javascript as per your requirement .

2.Now ,you need to create JCR Predicate expression to genarate XPATH query . Please find a sample predicate expression 

http://localhost:4502/libs/cq/search/content/querydebug.html 

type=dam:Asset
property=jcr:content/metadata/dam:size
property.value = 42018

How to add operators to the predicate expression to generate below XPATH

//element(*, dam:Asset)
[
jcr:content/metadata/@dam:size<42018 
]

I Hope this will work for you.

~kautuk



Kautuk Sahni