cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Image Display - Problem

Former Member
0 Kudos

Hello,

At WDRuntime on the click of the Connect button I am picking the images form MDM, and storing in the src/mimes/<component name> directory. I am storing the location / name of the image in the valueattribute of the context. While picking the data and images from MDM, records are added to the table and displayed except the Images. Images are not being displayed in the first attempt.

Any ideas???

Best regards,

Dharmi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Do you see the "missing image" placeholder in the browser? Right-click it and have a look at the URL? How does it look like?

Armin

Former Member
0 Kudos

Hello Armin,

Yes I see the missing image placeholder. The url looks like this:

http://serverip:50000/webdynpro/resources/local/WDMDMTestprj/Components/com.sap.mdmtest.comp.MDMTest...

and by trying the other way where i wouldn't get the image in t13/0000000 the url looks like below:

http://serverip:50000/webdynpro/resources/local/WDMDMTestprj/Components/com.sap.mdmtest.comp.MDMTest...

But that does not make a difference.

If i run this application after closing the NWDS and deploying it again it shows the images.

Regards,

Dharmi

Former Member
0 Kudos

Do you store the images in the IDE after that "connect" button click and then deploy the application?

If yes, do first a refresh on the folder in the "Navigator" view of Eclipse. Or did I misunderstand you?

Armin

Former Member
0 Kudos

Hello Armin,

At the connect button the images are picked from MDM, stored in the location of "mimes" and also displayed in the table.

For e.g. If the MDM catalog had 100 records and if I picked only 25 for testing, the images are not displayed you see only the image placeholder. I close the application by exiting the NWDS. I restart NWDS and now I try to pick 50 records, deploy and run , I see the first 25 images and for the next 25 I see again the image placeholder.

Hope the above is clear.

Best regards,

Dharmi

Former Member
0 Kudos

Did you try the "refresh" after loading new images and before deploying?

Armin

Former Member
0 Kudos

Hello Armin,

Sorry, I don't quite get you. Do "refresh" programmatically cos my application loads the image from MDM at runtime and in that same time saves in the location and also tries to display!

Regards,

Dharmi

Former Member
0 Kudos

There is obviously a misunderstanding here.

Do you store the images from MDM on the server or in your NWDS folder?

If you store them on the server, why do you need to redeploy your application?

Can you please clarify?

Armin

Former Member
0 Kudos

Hello Armin,

For yor application to display the images; the image has to be placed in the mimes/components/<xxxx> folder. This is were my images get stored.

Below is the code:

A2iValueArray imgs1 = rs.GetValueAt(i,"Images").GetValueArray();

if (imgs1 != null)

{

for (int j = 0; j < imgs1.GetCount(); j++)

{

<i>// GetBlob is the method in the Java API to pick the image from the MDM Product catalog.</i>

byte[] bImage = cd.GetBlob("Images", imgs1.GetValueAt(j).GetIntValue(),false);

try {

<i>//This is were the image is saved after being loaded</i>

FileOutputStream fs = new FileOutputStream("C:
Documents and Settings
Dharmi.Tanna
Documents
SAP
workspace
WDMDMTestprj
src
mimes
Components
com.sap.mdmtest.comp.MDMTestComp
Orgimg"i".jpg") ;

fs.write(bImage);

fs.flush();

fs.close();

<i>//This is were i am assigning the imageloaction to the node which is used to diaplay the table.</i>

ResultSetElement.setImage("Orgimg"i".jpg");

} catch (FileNotFoundException e) {}

catch (IOException e) {}

}

}

Regards,

Dharmi

Former Member
0 Kudos

From your code I see that you store the images on your client (where NWDS is installed).

To get them deployed on the server, you have to do the "refresh" as described and then redeploy the application. The "refresh" brings Eclipse in synch with the new content of the local filesystem such that new images are included in your project.

Apart from this: Is this only a testing scenario?

Armin

Former Member
0 Kudos

Hello Armin,

Yes, at this moment it is a testing scenario. Later on a web shop would be developed.

I tried the "refresh" and redeployed the application but this saves me of not exiting the NWDS and redeploying it.

The problem of it not displaying in the first run still remains. (This is the moment when the above codes is run for the very first time when there are no images in the mentioned location).

Regards,

Dharmi

p.s. Do let me know if you would like to see the screenshot of the same?

Message was edited by: Dharmi Tanna

Former Member
0 Kudos

Refresh, rebuild project, deploy does not work?

Armin

Former Member
0 Kudos

No it does not work and logically also it would not work on the first run since there are <b>no images</b> in the folder, they are loaded and saved only at runtime, in the second run the images are already in the folder so the refresh works there.

Regards,

Dharmi

Former Member
0 Kudos

I concluded from your description that you have one (local) application that first loads the images into mimes folder of a second application.

Then my proposal "refresh/rebuild/deploy/run" the second application after loading the images should work.

Why not loading the images directly onto the server and setting the image URL to take them from there?

Armin

Former Member
0 Kudos

The NWDS and the WAS are on the same server. MDM is on the other server (from where the images and other product related information is picked).

Regards,

Dharmi

Former Member
0 Kudos

I see. But you have to put the images into the server's storage area and not into your NWDS project to be able to show them with your application.

For testing, identify the folder where the images are stored on the server and let your application put them therein.

You don't have to use the mimes folder of the component but this simplifies the URL calculation (simply use image file name).

I hope this finally solves the problem.

Armin

Former Member
0 Kudos

Hello Armin,

Thanks a lot for all the help.

Nope the problem still remains <b>partly</b>.

In the first run I do see images for most of my records but <b>not for all</b> records (image place holder). I checked for the image (where there is just the image placeholder), and I do see the image in the server location but not on my WD application.

Best regards,

Dharmi

Former Member
0 Kudos

Hello Armin,

The problem still remains partly any more tips to solve it???

Best regards,

Dharmi

Message was edited by: Dharmi Tanna

Former Member
0 Kudos

Please describe:

- when are the images loaded, in an event handler?

- how is the Image.source property bound?

- are you using a table to display the images?

- what is the content of the mimes folder on the server before/after loading the images?

Armin

Former Member
0 Kudos

Hello Armin,

- when are the images loaded, in an event handler?

Images are loaded when a connect button is clicked.

- how is the Image.source property bound?

In the view context I have a valueNode for each column of the table and for image it is the Image value attribute (String) and Source of the image is bound to this value attribute.

- are you using a table to display the images?

Yes, I am using table to display the images

- what is the content of the mimes folder on the server before/after loading the images?

The mimes folder of the application is empty before/after loading the image. I am saving the images on the server on the c:/Temp/ImageCache.

Best regards,

Dharmi

Answers (0)