How can we add watermark to an expired asset in aem as a cloud? | Community
Skip to main content
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 ShaileshBassi

@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/watermark-assets.html?lang=en

Hope this helps!

Thanks

2 replies

ShaileshBassi
Community Advisor
ShaileshBassiCommunity AdvisorAccepted solution
Community Advisor
July 20, 2022
sunil_kumar_
Level 5
July 21, 2022

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.

 

Level 3
July 21, 2022

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?

ShaileshBassi
Community Advisor
Community Advisor
July 22, 2022

@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