How to re-generate wcm.io Media Handler rendition metadata for asset folders using a Workflow
If you are using the wcm.io Media Handler, some extra metadata needs to be generated for all renditions (except the original rendition) of any Asset used with it. This metadata contains the real width/height in pixels of each rendition. The width/height of each rendition is not stored anywhere by default, and to do the automatic detection of the best-matching rendition in an efficient way this information is needed in-place. By default it is generated automatically by a background service, the "wcm.io Media Handler Rendition Metadata Service" (provided that the system configuration is done properly).
However, if you have assets in your system that were present before installing the media handler with the background service, or for any other reason need to repair/update the metadata of already existing assets you can use a AEM Workflow with a custom workflow step provided by the media handler implementation to generate this metadata. The workflows step is also able to work with workflow packages, making it possible to process a bunch or whole subtrees of asset.
The process to use a custom workflow in a workflow package to process a whole subtree of assets is not very intuitive, this article describes the required steps.
This workflow support is available since wcm.io Media Handler 1.6.0.
Instructions
How to generate wcm.io Media Handler Rendition metadata for a subtree/multiple folders of AEM assets:
Create a new Workflow Model
http://localhost:4502/libs/cq/workflow/admin/console/content/models.htmlRemove all predefined steps from the workflow model
Add a new "Workflow / Process Step" component
Select "wcm.io Media Handler: Rendition Metadata" as process
Activate the "Handler Advance" checkbox
In the properties of the workflow, activate the "Multi Resource Support" checkbox
"Synch" the workflow model
Create a new workflow package page (using the Classic UI, seems not yet supported in the Touch UI)
http://localhost:4502/miscadmin#/etc/workflow/packagesAdd a new "Resource Definition" node for each AEM asset folder you want to process, and select the folder path in the properties dialog (e.g.
/content/dam/myproject)You now have to go to CRX DE Lite to manually change the filter rules of the two or more resource definition nodes you just entered via the UI (this is unfortunately not possible in the UI itself)
Within the workflow package page (below
/etc/workflow/packagesor/var/workflow/packages) go to thejcr:content/vlt:definition/filternode.For each child node that references your asset folder(s) in the
rootproperty, remove therulesstring array property, or change it in a way so it processed all assets in the folder and not only the folder itself.
Go back to the UI of the workflow package editor
In the Sidekick, select the "Worklow" tab, and select and start the workflow you created in step 1
With this, all assets in the referenced asset folders (and their subfolders) should have a full set of correct wcm.io Media Handler rendition metadata.
Related articles