Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

How can we add watermark to an expired asset in aem as a cloud?

Avatar

Level 3
 
1 Accepted Solution

Avatar

Correct answer by
Community Advisor
6 Replies

Avatar

Correct answer by
Community Advisor

@ReddyIshanvi Please refer to the link for adding the watermark to your asset https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/assets/manage/water...

Hope this helps!

Thanks

Avatar

Community Advisor

Hi @ReddyIshanvi,
You did not add much details about your use case. Let me try to answer with possible use cases. 
If you want to do it manually, There is a workflow process (Add Watermark) available to add watermark to assets. Create a workflow and run this workflow for expire assets.
If you want to do it at particular interval and automatically, Create a scheduler or job to find expired assets and execute this Workflow/Model using this scheduler.

 

Avatar

Level 3

Thankyou @sunil_kumar_ . This is helpful .How can I find out expired assets. I want to add a watermark as soon as an asset is expired. Also is there a way to remove the watermark when the expiry date is changed to a future date for an asset?

Avatar

Community Advisor

@ReddyIshanvi 

For that you can create the workflow launcher from the path "http://localhost:4502/libs/cq/workflow/admin/console/content/launchers.html" based on the event type i.e. "Modified". And within the process step for the workflow you can write the logic to check and perform the respective business logic to remove the watermark.

 

Or, you can write the EventHandler and from that you can perform the respective business logic to remove the watermark.

@Component(immediate = true, service = EventHandler.class, property = {
		Constants.SERVICE_DESCRIPTION + "= This event handler listens the events on page activation",
		EventConstants.EVENT_TOPIC + "=org/apache/sling/api/resource/Resource/ADDED",
		EventConstants.EVENT_TOPIC + "=org/apache/sling/api/resource/Resource/CHANGED",
		EventConstants.EVENT_FILTER + "(&" + "(path=/content/we-retail/us/en/*/jcr:content) (|("
				+ SlingConstants.PROPERTY_CHANGED_ATTRIBUTES + "=*jcr:title) " + "(" + ResourceChangeListener.CHANGES
				+ "=*jcr:title)))" })
public class CustomEventHandler implements EventHandler {

	/**
	 * Logger
	 */
	private static final Logger log = LoggerFactory.getLogger(CustomEventHandler.class);
	
	@Override
	public void handleEvent(Event event) {
		
		log.info("Event is: {}", event.getTopic());
	}

}

Reference - https://aem.redquark.org/2018/10/day-14-eventing-in-aem.html

 

Hope this helps!

Thanks

 

Avatar

Level 3

Thank you @Shailesh_Bassi_ . This is helpful. Can you also help explaining how can I trigger an event/action as soon as an asset is expired. I am looking for adding a watermark as soon as the status changes to expired for an asset.

Avatar

Level 3

Hi @ReddyIshanvi ,

I am having a same requirement to add a watermark to the expired assets, i have a logic in place to get the expired asset path. Can you please help here how i can add the watermark to those asset. 

My working scenario: Running scheduler to check the expiry date and moving the asset to archive folder.

Requirement: instead of archiving, i want to watermark the asset now.

Thanks,

Bhavani Bharanidharan