I have been able to fetch data with an ajax call from active directory .
The php file used to make the ajax call to active directory: http://pastebin.com/5VMPU6wp
The browser console shows that an ajax call returns this:
<p> sn: xxxxxx<br/>givenname: xxxxx<br/>
employeeID: 0050<br/
>distinguishedName: CN=xxxx xxxxx,OU=Employees,OU=Accounts,OU=India,DC=asia,DC=xxxxxxx,DC=com<br/>
displayName: Mark Hewettk<br/>sAMAccountName: xxxxxxx<br/>
department: xxxxx<br/>manager: CN=xxxxxx xxxxxxx,OU=Employees,OU=Accounts,OU=India,DC=asia,DC=xxxx,DC=com
<br/>
mail: mhewettk@abc.com<br/>
title: xyz<br/>
photo :����%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz���������������������������������������������������������������������������
The problem is that I am unable to display the thumbnail photo i.e the photo tag above.
I want to display the photo in a html popup window :
<img src="data:image/jpeg;base64,<?php echo base64_encode($data['thumbnailPhoto'][0]); ?>"alt="Please Upload your display pic." width="200" height="200" class="profile__image" id ="popupPic" />
I am able to display other attributes from the console such as title ,mail ,department etc by calling the jQuery as follows :
$('.leaderboard li').on('click', function () {
$.ajax({
url: "../popupData/activedirectory.php",
type: "POST",
data: {id:$(this).find('.parent-div').data('id')},
success: function(data){
console.info(data);
$('#popup').fadeIn();
var email=(data.split("mail:")[1]).split("title:")[0];
$('#emailOfUser').html('Email:'+ email);
var dept=(data.split("department:")[1]).split("manager:")[0];
$('#departmentOfUser').html('Department:'+ dept);
var pic=(data.split("photo:")[1]).split("manager:")[0];
$('#popupPic').append(pic);
},
error: function(){
alert('failed, possible script does not exist');
}
});
});
I tried this jQuery but no luck.
var pic=(data.split("photo:")[1]).split("manager:")[0];
$('#popupPic').append(pic);
This link from the community also did not help: Display thumbnailPhoto from Active Directory in PHP
How to display the photo from the above console data i.e the data retrieved from the ajax call?