Hello all,
I am trying to create a custom image component for that I need to get and display the image on the AEM page. In what are the ways I can do this and how to do? I tried with valuemap but not getting the exact results. Can anyone help me?
Solved! Go to Solution.
Views
Replies
Total Likes
As mentioned by Arun, Check image core component implementation [1], and follow the same approach.
On a high level, the code should look like this:
public class ImageModel { @ValueMapValue private String fileReference; public String getFileReference() { return fileReference; } }
The requirement is a bit unclear to me. Will your image component has a dialog to select an image or image component read an image from the page property?
yes , I have a dialog with image & text field . And I want to retrive them and display on page using sling model.
As mentioned by Arun, Check image core component implementation [1], and follow the same approach.
On a high level, the code should look like this:
public class ImageModel { @ValueMapValue private String fileReference; public String getFileReference() { return fileReference; } }
Please check the core component implementation
or check the implementation that I used, which basically uses core image but with custom component component https://github.com/arunpatidar02/aemaacs-aemlab/pull/2/files