cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing an Image dynamically from specified folder on server

Former Member
0 Kudos

The project is about keeping track of employee records.Each employee has a image.These images are saved on the server at a specified location i.e. <b>c:\images\</b>.This path along with other details are saved in the database.

While viewing the details of the employee in another view, his/her image should be displayed.

So my question is how to set image to the image UI Element?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI Sowmya,

Let the image source variable be <b>"Img".</b>

Here I am assuming that u want to display Sowmya.jpg from C:\Images in server.

Do the following.

File f=new File("C:
Images
Sowmya.jpg");//File name is Case sensitive

FileInputStream fis=new FileInputStream(f);

byte b[]=new byte[fis.available()];

fis.read(b);

IWDResource res=WDResourceFactory.createCachedResource(b,"Sowmya.gif",WDWebResourceType.UNKNOWN);

String url=res.getUrl(1);//GETTING URL OF IMAGE FROM SERVER

wdContext.currentContextElement().setImg(r);//SETTING IMAGE SOURCE

Regards

Fahad Hamsa

Former Member
0 Kudos

The problem is solved.Thanks Fahad.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Pl go through this blog

/people/anilkumar.vippagunta2/blog/2007/02/20/reading-and-writing-images-from-sqlserver-in-webdynpro

Regards

Ayyapparaj

former_member186016
Active Contributor
0 Kudos

See this thread :

Regards,

Ashwani Kr Sharma

Former Member
0 Kudos

You must put the images in a folder that is accessible via the Web AS or put them into a deployment unit. In either case, the Image UI element needs the URL to the image as value of its "source" property.

Armin

Former Member
0 Kudos

I tried doing it but what happens is, it is picking up image from my local system and not from the server. As I already mentioned that the images are on the server at location C:\images

Former Member
0 Kudos

Hi Sowmya,

Add two value attributes ( ImgSource) to

the value node for image.Make it calculated.In getter u can access the employee id or other details & set the source accordingly(Any how u r goin to get the source from the database.

regards

Sumit