Quantcast
Channel: SCN : Discussion List - SAP BusinessObjects Design Studio
Viewing all articles
Browse latest Browse all 4041

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

$
0
0

hello,

 

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!

Bea


Viewing all articles
Browse latest Browse all 4041

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>