Xpages images display in Web and not in the 8.5.2 Client

Hello I am trying to Display a Photo from another Document in an Xpage it works perfectly in the Web , but not in The Client. I have a Photo Document the same Database. The Photo is Attached as Rich Text Lite Thumbnail. The Document also has a field with the Attachment Name here is the Code

if(@ClientType()!=“Notes”)

{

var myName = rowData.getItemValueString(“UserName”);

var db = new Array(@Name(“[CN]”,@Subset(@DbName(),1))+“!!names.nsf”);

return @DbLookup(db,“($Users)”,myName,“PhotoUrl”);

} // end web

else

{

// Notes

var view = database.getView(“Photos”)

var doc = view.getFirstDocument()

var url= getImageHTML(doc)

return url

}

/**

Builds some HTML to display the photo for a contact

*/

function getImageHTML(doc:NotesDocument){

var files = doc.getItemValue("AttachmentNames");

var out = "";

var dbPath = getDbPath();



for (var i=0; i<files.length; i++){

	if (out != "")

		out += "<br />";

	if (files[i].toLowerCase().indexOf(".jpg") > -1 || 

		files[i].toLowerCase().indexOf(".gif") > -1 || 

		files[i].toLowerCase().indexOf(".png") > -1)

		out += "<img class=\"viewphoto\" src=\"" + dbPath[0] + "/xsp/.ibmmodres/domino/OpenAttachment/" + dbPath[1] + "/" + 

			doc.getUniversalID() + "/photo/" + escape(files[i]) + "\" />";

}

if (out != "")

	out = "<div class=\"screenshotimage\">" + out + "</div>";

return out;

}

/**

Cache the dbPath variables in an applicationScope variable

*/

function getDbPath(){

if(isCacheInvalid("dbpathweb", 600)){

	synchronized(applicationScope){

		var dbPath = @Left(context.getUrl(), ".nsf") + ".nsf";

		var pos = (context.isRunningContext("Notes")) ? 4 : 3;

		var secondPathElements = dbPath.split("/");

		var secondPath = "";

		for (pos; pos<secondPathElements.length; pos++){

			if (secondPath != "")

				secondPath += "/";

			secondPath += secondPathElements[pos];

		}

		var res:Array = new Array();

		res.push(dbPath);

		res.push(secondPath);

		applicationScope.dbPathWeb = res;

	}

}

return applicationScope.dbPathWeb;

}

/**

A generic caching mechanism for each key will check to see if it is 'n' seconds

since it was last updated. Use for things that change relatively infrequently  

*/

function isCacheInvalid(key, cacheInterval){

var currentTime	= new Date().getTime();

if (!applicationScope.containsKey(key + "_time")){

	applicationScope.put(key + "_time", currentTime);

	return true;

}

var diffInSecs	= Math.ceil((currentTime - applicationScope.get(key + "_time")) / 1000);

if (diffInSecs < cacheInterval) {

	return false;

} else {

	applicationScope.put(key + "_time", currentTime);

	return true;

}

}

Anybody on this?

Kind regards

Michael