How to display an image from data base into a HTML Field [message #1844335] |
Thu, 09 September 2021 17:07 |
|
Hello
I need to display an image inside a html filed, How can I do that when I fetch the image from database and it does not exist under icons folder, the HTML.getimageByBinaryResource( CharSequence s ) does not provide a solution for this and I think the name is incorrect here We dont pass a binary resource but a charsequence.
Is there any solution with the Eclipse scout SDK 11.
Kind Regards
|
|
|
|
Re: How to display an image from data base into a HTML Field [message #1844337 is a reply to message #1844336] |
Thu, 09 September 2021 17:33 |
|
For information, I used the code in an other thread and it is not working
is was recommended to use AbstractImageTile instead
The goal is the create image insode tiles when switch to tile mode in table
@Override
protected ITile execCreateTile(ITableRow row) {
BinaryResource img = BEANS.get(IMyService.class).getMYImage(id);
AbstractImageFieldTile imageFieldTile = new AbstractImageFieldTile() {
@Override
protected String getConfiguredLabel() {
return "Label";
}
@Override
protected int getConfiguredGridH() {
return 2;
}
@Override
protected void execLoadData() {
getTileWidget().setLabelVisible(false);
if (img != null)
getTileWidget().setImage(img);
else
try (InputStream in = ResourceBase.class.getResourceAsStream("images/not_found.png")) {
getTileWidget().setImage(new BinaryResource("not_found.png", IOUtility.readBytes(in)));
} catch (IOException e) {
throw new ProcessingException("resource", e);
}
getTileWidget().setAutoFit(true);
GridData gdh = getTileWidget().getGridDataHints();
gdh.horizontalAlignment = -1;
getTileWidget().setGridDataHints(gdh);
}
};
return imageFieldTile;
}
This is not working in case of table
|
|
|
|
Powered by
FUDForum. Page generated in 0.03905 seconds