cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to display image file (*.jpg)

Former Member
0 Kudos

Dear All,

I have used the Image element and bind it to a context attribute, say imageFile.

In wdDoInit, I set the image file name to imageFile by writing something like this:

wdContext.currentContextElement().setImageFile("imageA.jpg");

I have placed the imageA.jpg under /src/mimes/Components/

I have read some posts and articles saying that this image file should be placed in src/mimes/Components/<DC-package-name>, but somehow my <DC-package-name> got disappeared when checking out project from NWDI ( choose "remove local file when creating"....So <b>I manunally create a package folder under src/mimes/Components. I have checked my active DC on NWDI, and am able to find my imageA.jpg under src/mimes/Components/<DC-package-name>....</b>

But all I can see on internet is a "X" mark on the spot which is supposed to display my imageA.jpg. I have checked the property of "X" mark. It says the URL is : http://wehcsap51:50000/webdynpro/resources/winbond.com/home~kctvap01/Components/<i><b>com.winbond.wd...

(com.winbond.wd.kmct.contracttermhsheet.comp.ContractTermSheetComp is the folder I manunally created and added to DTR)

The pixel is 28 X 30....

Anyone knows which part I have missed???

Thanks for any input.

Zita

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Hello zita liao,

Be aware that the wdDoInit() should run at first time when you enter the web page. And I think you should code in method getImageSource().

1. You need put the picture file( *.gif ) to the following path:

(component name)\src\mimes\components\(com.sap...)

2. you should add your code in the method getImageSource(IImageElement), please try:

return "*.gif";

3.(option) you can add your code in the method getImageAlt(IImageElement), please try:

return "*.gif";

Meng

Message was edited by:

Lingxing Meng

Former Member
0 Kudos

Step1 : Place the image(jpg) in src\mimes\components\<project package>\place the image here

Step 2: Create one value attribute say image make. Set the calculated property for the value attribute to true. This step would automatically generate the setter and getter methods for the image attribute.

Step3: Use a UI element example Caption which has an image source property

Step 4: Bind the created value attribute for image to image source property.

Step 5: In the getimage method generated return the image. by default the return type would be null for ex: return "<imagename>.jpg". (Its case sensitive).

Hope this solves your problem.

Thanks and Regards,

Amar Bhagat Challa.

Former Member
0 Kudos

Hi Amar ,

I am sorry the solution you have suggested is not working! The spot still shows the "X" mark icon. It is working when my DC is LocalDevelopment, but somehow it does not work for server DC. The <project package> folder will disappear when checking out files from NWDI. I have to create it on my own.

Zita

Former Member
0 Kudos

Hi,

1. There are standard set of images in a folder called sapIcons in Web AS server.\

If ur images matches the same you can use them as ~sapIcons/<image name>.

2. You can check if the image is really a JPEG image. Sometimes, if a file is just renamed a JPEG it would not be recognized.

3. Try using Binary Cache.

WDWebResource.getWebResource should you help you in this case.

Regards

Bharathwaj