protected HtmlElement < ? > getImageElement ( Media media ) { Image img = new Image ( ) ; // Alternative text Asset asset = media . getAsset ( ) ; String altText = null ; if ( asset != null ) { altText = asset . getAltText ( ) ; } if ( StringUtils . isNotEmpty ( altText ) ) { img . setAlt ( altText ) ; } return img ; }
Create an IMG element with alt text .