April 9, 2020
Estimated Post Reading Time ~

Exploration of AEM DAM

My objective through this blog will be an exploration of commonly used features of DAM to support digital needs across multiple touch-points like websites, eCommerce sites, mobile devices, social networks, campaigns, and print catalogs in AEM 6.1
Prerequisites: AEM 6.1 instance, Linux operating system
Use Cases:
1. Custom renditions
2. Video Renditions
3. Watermarking
Let's get started!!
1. Custom Renditions
Every now and then a content author needs to populate their pages with images, videos, infographics, etc to make them more appealing to their audiences. And if you have worked as a content author (say, as a marketer responsible for your organization’s web presence) then you’d have used digital assets. Have you ever needed to put a big image as a banner on the home page and the same image put in an article within in small content area like in search results?
I bet you would have. To make this work we can simply scale down the image by specifying custom height and width and you have a small image for the small content area.
There is a big downside to this approach that though it might appear that the image has been scaled in dimensions but the actual image download size remains the same which could be painful and slow experience if I am viewing it on a mobile network.
One smart way to overcome this challenge is to create “renditions” of an image which is nothing but rendered alternatives of the same images. They are a binary representation of an asset that always generates when an asset is uploaded.
For generation of multiple renditions we can use different techniques like:
  • Adaptive image component with authorable renditions.
  • Generating dynamic renditions using imageMap servlet.
  • Using a custom xtype like multiHtml5SmartImage.
These approaches might require a lot of code and configurations whereas AEM DAM makes it super easy.
Steps to follow
Access the DAM update asset model from the workflow console (classic UI view steps listed below)
  • Access http://localhost:4502/libs/cq/workflow/content/console.html
  • In the Models tab, double click on the “DAM update asset” workflow.
  • Double click to edit the 14th workstep Processing Thumbnails. In the dialog box we can see under thumbnails tab some default resolution configurations in a multi-field, to which we can add or remove our custom resolution configuration too.
  • After adding the custom resolution, Click OK and save the workflow from the top left and close the workflow console.
  • The custom rendition of the resolution that we added will now be generated for every asset that is uploaded in the DAM.
customrenditions
2. Video Renditions
When a video is uploaded in AEM DAM, the same workflow DAM updates asset kicks in. Open it to see the highlighted work steps (below) which are responsible to create the video renditions in AEM 6.1
videoWorksteps
For these work steps to work we need to download ffmpeg plugin (AEM does not come packaged with it).
In Linux we just need to install ffmpeg plugin using the command:
sudo apt-get install as APT command retrieves, configures and installs the dependencies automatically.
In windows after downloading ffmpeg plugin from here, add ffmpeg\bin directory to the PATH variable in Environment Variables Section.
Henceforth, we succeed in achieving all the renditions specified as arguments in the process tab of the ffmpeg Transcoding (highlighted above) work step except hq profile that generates the .m4v format video that fails to generate with the following error.
*INFO* [Thread-85] com.day.cq.dam.handler.ffmpeg.FFMpegWrapper FFMPEG Exec: Unrecognized option ‘directpred’
To fix this, remove the custom ffmpeg arguments for the hq video profile, and set the audio codec as alac.
3. Watermarking
In today’s digital world, images and documents travel widely and swiftly, in multiple manifestations, through email, and across the Internet on social networking websites. Controlling and protecting sensitive/ confidential documents and images becomes very crucial as corporations or the content creators have very little visibility into exactly where their documents are being accessed or by whom.
Watermarking is one feature that enables corporations and brand owners to embed digital copyright data into their confidential documents and digital images
The Watermarking feature introduced in AEM 6.1 lets you add a digital watermark to assets, which helps users verify your authenticity and ownership of the copyright of the assets and can also be used as a good marketing strategy/ brand promotion.
We can add a watermark in the Dam Update Asset workflow simply by adding a process step to add a watermark.
For detailed steps, you can refer to the adobe documentation here.
Though I would like to highlight one issue that I faced in my Linux machine.
I followed all the steps mentioned in the documentation but when I uploaded an image in the AEM DAM, I could not see any watermark.
I proceeded to check my error.log file to see a FileNotFoundException (snapshot below)
rachna
When I tried to analyze this exception, I decided to go back to the package com.day.cq.dam.commons.watermark and decompiled the class WatermarkUtil.java. I came across the culprit code (highlighted below) that was trying to access the tmp folder in the root and since my AEM instance did not have the appropriate permissions, a FileNotFoundException was thrown.
rachna1
In order to give root access to my AEM instance, I tried the following command to start my AEM 6.1.
sudo java -jar AEM-author-4502.jar
Now my instance has the required permissions to locate tmp in the root. Now when restarting my instance with the command above, I could successfully get the watermarked images generated out of AEM DAM.


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.