Expand my Community achievements bar.

SOLVED

Get Image Files from JCR node through JCR API

Avatar

Level 2

Hi all, 

I have image files in a folder under DAM folder in JCR hierarchy.

How can I get the Image Files from JCR and display in a html page in my application?

I need to List images in a html page for display to user, so that user can pick some images from list of images in html page,

I need to query the Image files in JCR repository.

 

How to achieve this?

any suggestion is greatly appreciated. 

1 Accepted Solution

Avatar

Correct answer by
Level 10
2 Replies

Avatar

Correct answer by
Level 10

See the article -- http://helpx.adobe.com/experience-manager/using/aem-dam-image-components.html. It walks you through this use case. 

Avatar

Level 6

Chekout this : http://cq5demosearch.wordpress.com/2013/10/20/building-search-in-cq/

You can use the below code :

String xPathQuery = “/jcr:root/content/mydemosite/documents/Sales//element(*,nt:file)[jcr:like(@name,'%"+docName+"%')]“; //docName is search query
xPathQuery += ” order by @jcr:score ascending”;
log.error(xPathQuery);
Query query = session.getWorkspace().getQueryManager().createQuery(xPathQuery, Query.XPATH);
QueryResult result = query.execute();