Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Get Image from page properties


Level 4

I want to have a image that i uploaded in  the page properties of the child pages in parent page
Below is my code snippet:

  List<ExistingPagesModel> pagesList = new ArrayList<>();
        Resource parentResource = resourceResolver.getResource("/content/x/us/en/home/test");

        if (parentResource != null) {
            Iterator<Resource> childResources = parentResource.listChildren();
            log.info("childResources: {}");

            while (childResources.hasNext()) {
                Resource childResource = childResources.next();
                log.info("Processing child resource: {}", childResource.getPath());

                // Get property values from child resource
                childTitle = childResource.getValueMap().get("jcr:content/jcr:title", String.class);
                childDescription = childResource.getValueMap().get("jcr:content/jcr:description", String.class);
                childImage = childResource.getValueMap().get("cq:featuredimage/fileReference", String.class);

                // childImage = getChildImageFromResource(childResource);

                log.info("Child Title: {}", childTitle);
                log.info("Child Description: {}", childDescription);
                log.info("childImage: {}", childImage);
                if (childTitle != null) {
                    // Create an ExistingPagesModel object for each child page
                    ExistingPagesModel pageInfo = childResource.adaptTo(ExistingPagesModel.class);
                    if (pageInfo != null) {
        return pagesList;

Can somebody help me with that?
4 Replies


Community Advisor

@tatrived You are getting the fileReference URL of the child resource' image and what is the issue you are facing? 

please check this one too





Level 4

In the above code that i have provided i am not getting childImage 
yes i have gone through that article and used in same way it is mentioned in there
Let me know if you have any other solution



Level 9

@tatrived : Can you check what is this statement printing. Specially in a scenario when your parent page is having multiple child pages. 
 log.info("childImage: {}"childImage);
How are you retrieving pagesList -> pageInfo -> childImage .If you can share snippet, it would help visualize how you are reading this information.

Best way right now would be to debug with 1 child page under a parent and see if you get the image url.

Please let me know if it helps.



Level 9

@tatrived : Were you able to solve for this issue? Please let me know if you need any pointers.