cancel
Showing results for 
Search instead for 
Did you mean: 

How to bind an Image from a remote file (Not by adding it to the project)?

Former Member
0 Kudos

Hello,

I've created a phone book in DynPro.

I would like to extend this phone book by adding a picture next to each person. We have a network folder located at:
main-jr-fs1\Pics\ which contain all the workers pictures in jpeg. The name of the file is the User ID Number. My problem is how to bind the Image object source to the file, I can't simply put the path: "
main-jr-fs1\Pics\". At first I thought to upload the relevant image to a binary attribute in the Context and bind the Image to this Attribute but it looks like "source" accepts only String. Is there a solution to this? Meaning, can I bind jpg file to an application when the file is not added to the application excplicitly (Clearly I wont upload 4,000 images and deploy it with the app... )

Roy

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Roy,

Instead of copying the files to the default directory, you can create a folder as "RoyImages" in "C:\" and you can create HTTP alias in the visual adminstrator.

You can access the file using

http://<<hostname>>:portName/RoyImages/<<image file name>>

1. Copy of the image files to some location in the server (eg: c:\RoyImages)

2. Create a HTTP alias(eg. RoyImages) in the Visual Adminsitrator pointing to the file location (eg: c:\RoyImages).

3. Set the linkToURL reference property to http://<<servername>>:50000/RoyImages/<<Image file name>>

For creating the HTTP alias refer to the blog "Creating an HTTP Alias in WAS"

/people/renjith.andrews/blog/2005/03/31/creating-an-http-alias-in-was

Regards,

Santhosh.C

Answers (2)

Answers (2)

Former Member
0 Kudos

hi,

You can try this !

put your images in this path

\sap\<server instance name>\JC00\j2ee\cluster\server0\temp\webdynpro\web\sap.com\tcwddispwda\global\sapIcons

and u can then access it as ~sapIcons/<image name with extension>

Regards

Bharathwaj

Former Member
0 Kudos

Wait, I thought to put it on the IIS and set the image the http:// URL but your idea sounds even better, this way the images will be "protected" from "outside" browsing. So I got where to put the images but I didn't figure out how to access it. Can you please explain me in more details how to get to this path from the code?

10X,

Roy

Former Member
0 Kudos

Hi,

If u put it in the mimes\components folder u access it using the image name.

If its in this folder

set the source property to ~sapIcons/<image with extension>

Its their in my previous post ...

Regards

Bharathwaj

Former Member
0 Kudos

Sorry, but this is bad advice. This path is reserved to the SAP provided icons and should not be abused like this.

Armin

Former Member
0 Kudos

Hi Armin,

Hmmm.. Abuse is a strong word

But SAP might use some trick to make this sapIcons folder as the root.. If u can suggest that trick may be we can make any folder we want as a root..

Is their any way like the one am saying.. or is their anyother solution...

Regards

Bharathwaj

Former Member
0 Kudos

It is not a trick -- it is quite standard approach.

Run Visual Administrator, got to HTTP Server Settings and define your own alias (btw, you can see here that ~sapicons itself is just an alias)

VS

Former Member
0 Kudos

I did not mean to be harsh to you, sorry.

There are several possibilities:

- Put all these images into a Web Dynpro component and use the WDURLGenerator to create URLs that may be used as image source

- Put all these images anywhere where your application may access them and use these URLs for the image source.

I darkly remember that there is the possibility to create own alias names like "~sapicons" but I have to check it out first.

Ok, Valery knows where to do this, thanks.

Armin

Message was edited by: Armin Reichert

Former Member
0 Kudos

Than you all for the advices.

I am not in front the porta now but I'll try the HTTP alias tomorrow and let you know how it went...

Roy

Former Member
0 Kudos

Hey Val,

Two questions:

1. Where do I find HTTP Server Settings on the Visual Administrator? I couldn't find it. I am using SP11 by the way.

2. After creating such an alias, does this mean that these pics will be available to anyone inside the LAN who browses to this URL? If yes, is there any way to prevent this and allow only applications that are running inside the portal context approach this directory? I can do the same on the IIS but one of the reasons I don't want to is because of that...

Roy

Message was edited by: Roy Cohen

Former Member
0 Kudos

It is here:

Root(SID)-> Server 0 (your-server-ID) -> Services -> HTTP Provider.

Open "Aliases" tab. Btw, I was wrong -- "~sapicons" alias implemented somehow different.

After creating an alias all content becomes publically available. Sadly, I don't know how to restrict access. Try to post this question on General WebAS forum.

VS

Former Member
0 Kudos

I'll do that 10q

Former Member
0 Kudos

Hey I think I got it, I'll put Virtual directory on the IIS and refer to it dynamiclly. Am I right?