hi there,

trying to get a view of a ldap db with name, phonenumber and photo. but the last part: the photo
seems to be tricky.
have found this request in the post installation section (Adding images to a view (LDAP)) and also these issues:
http://drupal.org/node/1774936
http://drupal.org/node/1787970
http://drupal.org/node/1533492

but I don't know yet if it is possible or what I do wrong.

added a ldap query with the attributes Name,TelephoneNumber,thumbnailPhoto and created a ldap view with those 3 attributes.
but the photo isn't shown.

thx for your help in advance!

greets ifux

Comments

matthewgann’s picture

Would like to be able to do this as well separate from the user system (not all people in AD will be a user in Drupal).

matthewgann’s picture

Got it working. Just FYI from a lot of different posts.

In the latest dev, goto modules/ldap/ldap_views/plugins/ldap_views_plugin_query_ldap.inc, around line 258, after the first if, add

else if (isset($entry['thumbnailphoto'])) {
    $entry['thumbnailphoto'][0] = "data:image/jpeg;base64," . base64_encode($entry['thumbnailphoto'][0]);
}

In your view, add the thumbnailphoto attribute. Rewrite the results to:
<img src='[attribute_10]' alt='photo' />

It works for me.

c3rberus’s picture

Hi,

We are also looking for a way to pull AD photos from the thumbnailPhoto from AD into Drupal for users. Currently this is a manual process for us.

We use "feeds" to import AD users into Drupal for a "Employee List" view page.

What you are saying is.. I can add a "image" field type into my content type and using feeds I can map the thumbnailPhoto attribute to the "image" field type, run the feeds import and we should be able to "import" AD photos?

Thanks.

matthewgann’s picture

If you're just doing an employee list, I'd use LDAP query and create a view instead of using feeds.

c3rberus’s picture

We are using feeds to import new employees from AD, then we are using views to present the feed. We need both, so that our employee list found on the Intranet is current.

LDAP Feed is configured to run nightly, updating existing users (department, office, name changes) and adding new users.

dolcaer’s picture

I've also filed a new feature request for importing images through feeds, as this is exactly what i need. I've tried to use an LDAP query view at first too, but this will likely be too heavy for our server to handle when users are actively using it.

larowlan’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

no update for > 12 months - closing

tomhung’s picture

I would love to get #2 committed to the Dev or PRD version of this module.

rooby’s picture

Component: Documentation » Code
Category: Support request » Feature request
Status: Closed (outdated) » Needs review
StatusFileSize
new1011 bytes

Here is a patch based on the code in #2 for latest dev.

Works for my testing.

grahl’s picture

Status: Needs review » Needs work

It's not a great solution but should work for the majority of cases, so I'm fine committing this.

Could you please make the quotes and escapes valid and consistent for jpegphoto as well as thumbnailphoto? Also, should there really be a space in the data url before base64 encoding?

rooby’s picture

Hmm, that's probably a no on the extra space.

I'm working on this site currently so I'll update the patch either today or tomorrow.

grahl’s picture

Hi

Sorry for nagging, any chance we could get the updated patch?

rooby’s picture

Status: Needs work » Needs review
StatusFileSize
new1009 bytes

Oops sorry.

  • grahl committed d75a355 on 7.x-2.x authored by rooby
    Issue #1943092 by rooby: LDAP Views: How to get thumbnailPhoto into the...
grahl’s picture

Status: Needs review » Fixed

Thanks! Patch committed.

This is not relevant for 8.x since Views relies on a separate field class, which the user can choose to embed base64 encoded images and thus we do not need to hardcode this any longer: http://cgit.drupalcode.org/ldap/tree/ldap_query/src/Plugin/views/field/L...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.