I have added a picture to a user through the OpenDJ Control Panel, but I can't seem to retrieve that picture so I can show it on a webpage. I have found two attributes thumbnailPicture and photo and tried accessing it the following way:
NamingEnumeration<?> namingEnum = ctx.search(baseFilter, "(uid="+username+")", searchControls);
if (namingEnum.hasMore ()){
SearchResult result = (SearchResult) namingEnum.next ();
Attributes attrs = result.getAttributes ();
photo=(String)attrs.get("thumbnailPicture").get() ;
}
With the code is nothing wrong because I can retrieve an email adres for example when I change photo=(String)attrs.get("thumbnailPicture").get() ;
to
photo=(String)attrs.get("mail").get() ;
I noticed that when adding a picture through the OpenDJ Control Panel it goes via a browse button so I'm guessing the path should be stored somewhere?
I don't get any error messages (I presume because the attributes thumbnailPicture and photo aren't filled in in OpenDJ so they return empty) but what I would like is:
- the path to where the picture is saved but it's just a guess that OpenDJ actually stores this information?
- the possibility to retrieve the picture but I'm not sure as what it is saved in OpenDJ. The code now is meant for the path of the file (that's why there's a cast to String).