You can check the fields being exposed via model.json
{
"src": "/content/dam/my-site/avatar.jpg",
"alt": "Profile picture of John",
"title": "John's Avatar",
"caption": "This is John's profile image.",
"uuid": "12345-abcde"
}
on the react side something like this could be done. Make the necessary imports
const ImageWithMetadata = (props) => {
if (!props || !props.src) {
return null;
}
return (
<div className="image-with-metadata">
<img src={props.src} alt={props.alt || ''} title={props.title || ''} />
<div className="metadata">
{props.title && <h3>{props.title}</h3>}
{props.caption && <p>{props.caption}</p>}
{props.alt && <p>{props.alt}</p>}
</div>
</div>
);
};
ImageWithMetadata.defaultProps = {
src: '',
alt: '',
title: '',
caption: ''
};
// Map to AEM core image component resource type
export default MapTo('core/wcm/components/image/v2/image')(ImageWithMetadata);