Get all dynamic media renditions and fetch scene7 URL from Asset | Community
Skip to main content
New Member
December 6, 2023
Solved

Get all dynamic media renditions and fetch scene7 URL from Asset

  • December 6, 2023
  • 2 replies
  • 977 views

Why is the asset.getRenditions() function in AEM only returning Static / Original renditions and not Dynamic renditions, even though I can confirm the presence of Dynamic renditions for the asset in the AEM Asset manager?

 

Code Snap: 

private static void getDynamicRenditions(Asset asset) {

    List<Rendition> renditions = asset.getRenditions();

    for (Rendition rendition : renditions) {

      String renditionPath = rendition.getPath();

      String renditionName = rendition.getName();

    }

  }

 

Asset Renditions: We are only getting Static Renditions and original rendition but not Dynamic Rendition.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Shashi_Mulugu

@amchauha getrenditions() method gets only renditions which are static/stored in aem.. while DM renditions are dynamic in nature and will get stored except in its own CDN cache..

 

So have write your business logic to get DM renditions..

https://github.com/adobe/aem-core-wcm-components/blob/main/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/models/v2/ImageImpl.java

2 replies

Shashi_Mulugu
Community Advisor
Shashi_MuluguCommunity AdvisorAccepted solution
Community Advisor
December 7, 2023

@amchauha getrenditions() method gets only renditions which are static/stored in aem.. while DM renditions are dynamic in nature and will get stored except in its own CDN cache..

 

So have write your business logic to get DM renditions..

https://github.com/adobe/aem-core-wcm-components/blob/main/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/models/v2/ImageImpl.java

aanchal-sikka
Community Advisor
Community Advisor
December 7, 2023

Just extending to @shashi_mulugu suggestions. The Image WCM Core component uses both the Adaptive Image and the DM delivery.

It uses both Preset and Smart Crop.

 

You might want to extract whats needed for you. Preferably create it as a separate Service. 

DM delivery feature might not be available for all WCM core components, so separate service would help, incase you need it 

Aanchal Sikka