Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

Get the Asset meta data from the asset node in AEM | AEM Community Blog Seeding

Avatar

Administrator

BlogImage.jpg

Get the Asset meta data from the asset node in AEM by keshav chaurasiya

Abstract

Get the Assets meta data from the asset node in AEM sling model

@Model(adaptables = {SlingHttpServletRequest.class,Resource.class}, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL, resourceType="myproject/components/content/image")

@Exporter(name="jackson", extensions="json", options= {

@ExporterOption(name = "MapperFeature.SORT_PROPERTIES_ALPHABETICALLY", value = "true")

})

public class ImageModel{

private static Logger LOG = LoggerFactory.getLogger(ImageModel.class);

@SlingObject

private SlingHttpServletRequest request;

@Inject

@Via("resource")

private String image;

}

@Inject

@Via("resource")

private String imageMetaData;

/**

* @return the imageMetaData

*/

public String getImageMetaData() {

String url = request.getRequestURI();

Resource resource = request.getResourceResolver().getResource("/content/dam/my-project/image/image.png");

Asset asset = resource.adaptTo(Asset.class);

String width = asset.getMetadataValue("tiff:ImageWidth");

return this.imageMetaData;

}

}

Read Full Blog

Get the Asset meta data from the asset node in AEM

Q&A

Please use this thread to ask the related questions.



Kautuk Sahni
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

0 Replies