Skip to content

Add Next Gen Dynamic Media (NGDM) support to the StaticImage component - #1965

Open
pankaj-parashar wants to merge 1 commit into
masterfrom
feature/dynamic-media-support
Open

Add Next Gen Dynamic Media (NGDM) support to the StaticImage component#1965
pankaj-parashar wants to merge 1 commit into
masterfrom
feature/dynamic-media-support

Conversation

@pankaj-parashar

Copy link
Copy Markdown
Contributor

Ports the NGDM asset support from adobe/aem-core-wcm-components#2481 to the Adaptive Forms StaticImage (form/image v1) component. When the fileReference is an NGDM asset (/urn:...) and the NextGenDynamicMediaConfig OSGi service is enabled, the delivery URL is built directly instead of resolving a DAM rendition. Bumps aem-sdk-api to 2023.9.13665 to pick up the NextGenDynamicMediaConfig API, and enables the NGDM asset picker on the component's file upload dialog field.

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes and the overall coverage did not decrease.
  • All unit tests pass on CircleCi.
  • I ran all tests locally and they pass.

Ports the NGDM asset support from adobe/aem-core-wcm-components#2481 to
the Adaptive Forms StaticImage (form/image v1) component. When the
fileReference is an NGDM asset (/urn:...) and the NextGenDynamicMediaConfig
OSGi service is enabled, the delivery URL is built directly instead of
resolving a DAM rendition. Bumps aem-sdk-api to 2023.9.13665 to pick up
the NextGenDynamicMediaConfig API, and enables the NGDM asset picker on
the component's file upload dialog field.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

1 similar comment
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...nents/internal/models/v1/form/StaticImageImpl.java 83.33% 0 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!


public static final String DAM_REPO_PATH = "fd:repoPath";

private static final String NGDM_REFERENCE_PREFIX = "/urn:";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you extract this out as utils, lets not pollute image with so much code

private static final String PATH_PLACEHOLDER_SEO_NAME = "{seo-name}";
private static final String PATH_PLACEHOLDER_FORMAT = "{format}";
private static final String DEFAULT_NGDM_ASSET_EXTENSION = "jpg";
private static final int DEFAULT_NGDM_ASSET_WIDTH = 640;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is 640 default and jpg default ?

.replace(PATH_PLACEHOLDER_SEO_NAME, assetName)
.replace(PATH_PLACEHOLDER_FORMAT, assetExtension);

return "https://" + nextGenDynamicMediaConfig.getRepositoryId() + imageDeliveryPath

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be exposed as a URL in crispr json for headless delivery as well ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getImageSrc() is @JsonIgnored on the StaticImage interface, but getValue() is not, and getValue() delegates to getImageSrc() — so the NGDM-resolved URL already flows into the "value" field of the exported JSON (crispr) model. The PR's own test (testNgdmImage) already asserts image.getValue() equals the NGDM URL too

sling:orderBefore="visible"
sling:resourceType="cq/gui/components/authoring/dialog/fileupload"
class="cq-droptarget"
enableNextGenDynamicMedia="{Boolean}true"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be namespaced as fd:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this exact, non-namespaced property name is read directly by the platform's own cq/gui/components/authoring/dialog/fileupload widget (/libs/cq/gui/components/authoring/dialog/fileupload/render.jsp:
final String ENABLE_NEXT_GEN_DYNAMIC_MEDIA = "enableNextGenDynamicMedia";),
not something we invented — it's a fixed contract the shared widget expects.
Namespacing it fd:enableNextGenDynamicMedia would break it silently (the widget just wouldn't see the flag, silently falling back to non-NGDM behavior)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants