Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Design Studio - Display a dummy image when searched photo does not exist


I would like to display an employee photo, which should be searched on the server folder with URL.

Each photo name in my folder is : "employeeId.png".

But some employees do not have a photo, and in this case I try to display a dummy photo, which I have in the same folder with employee id 00000000.

My variables are :

- URLlink variable is global variable type URL, which gives a path to my folder with employees photos

- empnb variable is filled with employee id through getSelectedMember on cross table

- filename variable to search a photo on the server

- filename0 variable for those employees for which photo does not existe

I tried to test the existence of an employee photo with getHeigh() method or getImage() method, to check if a photo filename set in Image1 is a real

one. Cause if a photo does not exist, the Design studio put by default a small black cube inside Image.

Unfortunatelly these tests are not working .

My script:

var filename =  URLlink + empnb + ".png";    // existing employee photo

var filename0 = URLlink + "00000000" + ".png";  // dummy profile photo

IMAGE_1.setImage(filename); //Try to put a photo found on the server 

var height = IMAGE_1.getHeight(); 

if (height == -1)

{ IMAGE_1.setImage(filename0);   }

else   {IMAGE_1.setImage(filename);}

Does anyone have other idea how to test if a photo exist or not in my folder.

Many thanks!


Former Member

Hi Beata,

I can offer you the SDK component on short term:

Design Studio SDK: Fallback Picture Component

Feel free to check if this helps you.

If you need help, just ask - example application is attached on the blog post (via GitHub).

Regards, Karol

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question