We have a TileGrid showing images in each tile with a DetailViewerField, with the type "image". All of the images are all different sizes. Most of them are more or less square so they look great. There are a couple that are very wide and the thumbnail gets clipped instead of the image scaled down to fit the tile.
Is there a way to control this behavior so that the image thumbnail is contained within the tile instead of being clipped?
Here's how we have the field defined:
Without the line setting the imageSize to null everything gets very distorted.
Is there a way to control this behavior so that the image thumbnail is contained within the tile instead of being clipped?
Here's how we have the field defined:
Code:
final DetailViewerField imageField = new DetailViewerField(DSConst.DocumentSQL.DOCUMENT); imageField.setType("image"); imageField.setDetailFormatter((o, r, detailViewerField) -> { final String url = StringUtils.isNotEmpty(r.getAttribute(DSConst.DocumentDataSQL.URL)) ? r.getAttribute(DSConst.DocumentDataSQL.URL) : "data:" + r.getAttribute(DSConst.DocumentSQL.MIME_TYPE) + ";base64," + o; detailViewerField.setImageSize((Integer) null); return url; });
Comment