Skip to content

Add selection options for DynamicMedia SmartCrops #480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

andreas-haller
Copy link
Collaborator

This PR gives more flexibility in using the AssetSelector for adding images to DA.

aem.asset.dm.delivery = 'on'

This option adds DynamicMedia URLs (https://delivery-...) to the DA documents but still use the author (with folder structure) to select via the AssetSelector UI.

aem.asset.smartcrop.select = 'on'

This options enables a selection screen after the AssetSelector UI closes to give the authors a options to choose which DynamicMedia SmartCrop rendition should be added to the document.

responsive-image sheet in config

On this sheet administrators can define a set of crops which should be added together as a set to the document. It is also aware of the current selection (see position) and can provide different sets for inside or outside blocks. If the configuration applies the author has in the crop selection view not only the option to add a single image but choose from predefined sets like adding variant 1-1 and 3-4 together.

Configuration

| name | position | crops |
| <arbitrary descriptive name> | <everywhere|outside-block|<block name>> | <list of smartcrop ids> |
| default | everywhere | 1:1, 3:4 |
| Hero | hero | 16:9, 4:3, 3:4 |

Additional Features

  • dam:activationTarget and reviewStatus metadata properties are checked before trying to add an image and give the user a reasonable error message

Motivation and Context

In our client project the authors want to have a flexible way to not only choose from DynamicMedia SmartCrops and add them to the document but also see those images directly in the document and having the option to exchange individual crop variants with completely different assets if necessary.

How Has This Been Tested?

I developed the JS by using the browsers dev tools override mechanism, injecting my adjusted da-assets.js and da-assets.css. I could not use a normal local setup as testing requires AEM Asset access which is not possible with the staging IMS for my user.

Screenshots:

Custom Image Profile Setup in AEMaaCS:

image

Manually Adjusting SmartCops per Asset if necessary

image

Sample Config in DA

image
image

Crop Selection Screen after selecting an Asset via AssetSelector

image

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 code follows the code style of this project.
  • 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.
  • All new and existing tests passed.
    I was not able to run the test locally and there does not seem to be an existing test for that part of da-live. Please advice how to proceed.

Copy link

aem-code-sync bot commented Jun 27, 2025

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

if (dmDeliveryEnabled && activationTarget !== 'delivery' && reviewStatus !== 'approved') {
assetSelectorWrapper.style.display = 'none';
cropSelectorWrapper.style.display = 'block';
cropSelectorWrapper.innerHTML = '<p class="da-dialog-asset-error">The selected Asset is not available. Please check the activation target and review status.</p><div class="da-dialog-asset-buttons"><button class="back">Back</button><button class="cancel">Cancel</button></div>';

Choose a reason for hiding this comment

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

Would this be a better message?

The selected asset is not Approved for Delivery. Please choose another asset.

Since regular authors may not know what activation target or review status means.

@sagarsane
Copy link

Tested both the features and both look great! Thank you for this!

auniverseaway
auniverseaway previously approved these changes Jul 11, 2025
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.

3 participants