I have created a custom workflow step to create rendition of an existing DAM asset by cropping the original asset.
It is working as expected if it is configured as standalone model and apply yo existing DAM asset.
But I have requirement to integrate this step as part of "DAM Update Asset" workflow. I have tried having this Process step in the "DAM Update Asset" workflow but it will not create the custom rendition. Following is the code snippet for cropping the image. When I check the log "resource" returns the correct value from the session. Problem is with the "dataSource" which returns null as the original rendition is not yet written yet. Can someone suggest to create the custom rendition by cropping the original image and trigger this step while the DAM asset is being created.
1. Resource resource = getResourceFromPayload(item, session.getSession());
2. Resource dataResource = resource.getChild("jcr:content/renditions/original/jcr:content");
3. layer = ImageHelper.createLayer(dataResource);
4. Rectangle rect = ImageHelper.getCropRect(crop, resource.getPath());