Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Dynamic media images/videos for custom components


Level 3

Can you please provide some context on using dynamic media images/videos for custom components? If anyone is using this feature, please share some details.


Topics help categorize Community content and increase your ability to discover relevant content.

4 Replies


Community Advisor


I don't think there is an official approach on how to do this, but in reality, it is not that complicated. You just need to keep in mind that you simply need to invoke a correctly formatted URL and/or load the proper JS (if you are using one of the viewers). With that in mind, you can check how the Core components component does this. Basically, you can check this: https://github.com/adobe/aem-core-wcm-components/blob/main/bundles/core/src/main/java/com/adobe/cq/w... 

Something like this would work:

String dmAssetName = asset.getMetadataValue(Scene7Constants.PN_S7_FILE);
if(isDmFeaturesEnabled && (!StringUtils.isEmpty(dmAssetName))){
//image is DM
dmImage = true;
//check for publish side
boolean isWCMDisabled = (com.day.cq.wcm.api.WCMMode.fromRequest(request) == com.day.cq.wcm.api.WCMMode.DISABLED);
//sets to '/is/image/ or '/is/content' based on dam:scene7Type property
String dmServerPath;
if (asset.getMetadataValue(Scene7Constants.PN_S7_TYPE).equals(Scene7AssetType.ANIMATED_GIF.getValue())) {
} else {
String dmServerUrl;
// for Author
if (!isWCMDisabled) {
dmServerUrl = dmServerPath;
} else {
// for Publish
dmServerUrl = asset.getMetadataValue(Scene7Constants.PN_S7_DOMAIN) + dmServerPath.substring(1);
dmImageUrl = dmServerUrl + dmAssetName;


Hope this helps

Esteban Bustamante


Community Advisor



You can also use IMAGE_DELEGATE to use WCM Core image component to render images, which will also take care of DM aspect. It is used by Teaser as well



Aanchal Sikka



@Sai1278 Did you find the suggestions from users helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni


Level 3

Hi @kautuk_sahni and @aanchal-sikka @EstebanBustamante  

I have done recently migration dynamic media clasic 

next step is to update all logic within the system that currently points to static renditions and the old S7 Classic to the new repository URL. This involves migrating from the classic Dynamic Media setup to the native implementation.

Now they want to this rendition $Web1000x1000$ requirement is all images are in sync with dynamic media the rendition we don't have to use the static but the new automatically created from dm7. Please provide some suggestions