cancel
Showing results for 
Search instead for 
Did you mean: 

How to display an image, which is stored in a database?

Former Member
0 Kudos

Hi All,

I would like to display an image with Web Dynpro.

I already know how to display an image which is stored in the path src/mimes/Components/...

But does anybody knows, how to display an image which is stored in a database (e.g. MaxDB)as a datatype of binary?

Thanks in advance!

Regards,

Silvia

Accepted Solutions (0)

Answers (1)

Answers (1)

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Silvia,

see .

Regards, Bertram

Former Member
0 Kudos

Hallo Bertram,

thanks for your helpful answer!

Regards,

Silvia

Former Member
0 Kudos

hello Bertram,Silvia

I am trying to display an image dynamically from the portal database to

table in webdynpro.I worked on the above solutions.but which is the UI element to be used

for binding stramed byte from the context.I used "FileDownload UI",but it displays only

when it is clicked on the link.Can we use "Image UI element for binay stream?when the view is displayed it should show the image automatically.

if so ,how can it be done?

regards

John

Former Member
0 Kudos

Hallo John,

yes, you can use the Image UI element.

Further you have to create a String for the URL. Implement like as follows:

IWDCachedWebResource cachedResource = null;

String imgUrl = null;

WDAttributeInfo attInfo = wdContext.getNodeInfo().getAttribute(IPrivateXYView.IXYElement.PIC_DB);

IWDModifiableBinaryType binaryType =

(IWDModifiableBinaryType) attInfo.getModifiableSimpleType();

binaryType.setMimeType(WDWebResourceType.JPG_IMAGE);//Example *.jpg

WDWebResourceType type = binaryType.getMimeType();

byte[] file = wdContext.currentXYElement().getPicDB();

if (file != null)

{

cachedResource = WDWebResource.getWebResource(file, type);

try

{

imgUrl = cachedResource.getURL();

}

catch (WDURLException e)

{

IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();

msgMgr.reportException(e.getLocalizedMessage(), true);

}

}

I hope it will help you.

Regards,

Silvia

Former Member
0 Kudos

Thanks a lot Silvia .

it worked!!