#Adobe Experience Manager

How to Create Image Component in Adobe Experience Manager (AEM): A Comprehensive Guide

Contents

In Adobe Experience Manager (AEM), components are the primary elements that content authors use to build pages. One of the most frequently used components is the Image Component, which allows authors to add and manage images within their content. This guide will walk you through the process of creating an image component in AEM.

Key Takeaways

  • An image component in AEM allows content authors to add and manipulate images on a page.
  • The process of creating an image component involves accessing and using AEM’s CRXDE Lite.
  • A custom image component requires a specific structure, including nodes for the component, dialog, and image rendition.
  • Validation and testing of the created component are crucial to ensure correct functionality.

Understanding the Image Component

An image component in AEM is a reusable piece of content that allows content authors to add an image to the page, define its size, alignment, alternate text, and other properties. It provides authors with flexibility and control over how images display on their pages.

Accessing CRXDE Lite

To create a custom image component, you’ll need to access CRXDE Lite, which is AEM’s built-in development environment.

Steps to Access CRXDE Lite

  1. Open your web browser and navigate to http://[your_AEM_server]:[port]/crx/de.
  2. Log in with your AEM credentials.

Creating the Component Structure

After accessing CRXDE Lite, you’ll need to create the structure for your image component.

Steps to Create the Component Structure

  1. In the left-hand side panel, navigate to /apps/your_project/components.
  2. Right-click on the components node and select Create -> Create Node.
  3. Name the node after your component (e.g., ‘myImage’) and set the jcr:primaryType property to cq:Component.
  4. Create a cq:dialog node under your component node and set its jcr:primaryType property to nt:unstructured.

Defining the Dialog

The dialog is where content authors will configure the image properties. You need to define this in your component structure.

Steps to Define the Dialog

  1. Under the cq:dialog node, create a content node with jcr:primaryType set to nt:unstructured.
  2. Under the content node, create an items node, also with jcr:primaryType set to nt:unstructured.
  3. Under the items node, create a node for each property you want the image to have (e.g., ‘file’, ‘alt’, ‘title’, etc.). Set their jcr:primaryType to nt:unstructured and define their properties as needed.

Adding Image Rendition

The image rendition defines how the image will be displayed on the page. It’s defined in the component’s html.jsp file.

Steps to Add Image Rendition

  1. Under your component node, create a file named html.jsp.
  2. In this file, write the JSP code that will render the image using the properties defined in the dialog.

Saving Your Changes

After defining the dialog and adding the image rendition, you need to save your changes.

Steps to Save Changes

  1. Click the Save All button at the top of the CRXDE Lite interface.

Validating the Component

The final step is to validate that your component works as expected.

Steps to Validate the Component

  1. Navigate to a page in the AEM authoring interface.
  2. Open the component side panel and find your image component.
  3. Drag the component to the page, configure it using the dialog, and verify that it displays correctly.

Conclusion

Creating a custom image component in AEM gives content authors more control over how images are displayed on their pages. By understanding the process of creating an image component in AEM, you can extend the functionality of your AEM site and provide a richer content authoring experience.

Back to Glossary

Axamit Blog

Get Inside Scoop on Adobe Experience Manager Updates, Trends, Best Practices
September 6, 2024

Optimizing Adobe Experience Manager Performance: Expert Techniques for Peak Results

Discover actionable techniques to boost Adobe Experience Manager performance and ensure a seamless experience for your users.

Read More
AEM Migration from Your Current CMS
July 9, 2024

Conquering AEM Migration: Shift Seamlessly From Your CMS to Adobe Experience Manager

Discover the core CMS issues that lead enterprises to upgrade to AEM and build your foundation around the migration process as a whole.

Read More
Future-Proof Your Content Authoring with a Component Content Management System
June 7, 2024

Future-Proof Your Content Authoring with a Component Content Management System

You could be leaving untapped ROI on the table with a standard CMS. But a CCMS can fix that, and we’ll explain how.

Read More