Search code examples
imagehippocms

How to create image attributes in HippoCMS 7.9?


I'm currently working on a hippo component within (7.9) and I need the image link, alt, and title:

Component Method:

public HippoGalleryImageSetBean getImage() {
    return getLinkedBean(Constants.NS_FLD_IMAGE,
            HippoGalleryImageSetBean.class);
}

I would like to write my Component JSP like this below:

    <c:forEach var="item" items="${ document.links }"
               varStatus="loopStatus">
               <hst:link var="image"hippobean="${ item.image.original }" />

               <li><img
                    src="${ image }"
                    alt="${ image.alt }"
                    title="${ image.title} ">
                </li>
    </c:forEach>

Solution

  • The 'alt' and 'title' are defined on the imageset itself and not in the image variants. ${image} in your case is the link generated to an image and not the image object itself.

    Try it with:

    <c:forEach var="item" 
               items="${ document.links }"
               varStatus="loopStatus">
      <hst:link var="imagelink"hippobean="${ item.image.original }" />
      <li><img src="${ imagelink }"
               alt="${ item.image.alt }"
               title="${ item.image.title} ">
      </li>
    </c:forEach>