I'm using the ldap_integration module with drupal 4.7 for my company's intranet site. In my LDAP server I have jpegPhoto attribute that has the users photo and I've no problem viewing it using phpldapadmin, a web interface to my LDAP server, but not so lucky when it comes to Drupal, I only get "???" when I map the LDAP attribute to drupal. Here's how i did it:
- In the drupal/modules/ldap_integration/conf.php file, there an existing attribute supposely to display user's homepage screenshot(?) called wWWHomePage and the attribute type is "image":
'wWWHomePage' => array('image', 'textfield', t('Web Page'), 64, 64, ''),
- So I copied this line end edited it into something like this:
'jpegPhoto' => array('image', 'textfield', t('Photo'), 64, 64, ''),
- then from the admin/settings/ldap_integration page in LDAP, I can select "Photo" from the list of LDAP attributes to display to users and save the configuration. When I go to the user's account page, all the text-type information (e.g First Name, Last Name, Display Name, etc) from LDAP are shown correctly, but not the jpeg image.
Is this feature currently supported?
Thanks & Rgds,
Hendra
Comment | File | Size | Author |
---|---|---|---|
#29 | ldap_integration-profile-images-updated-bug.patch | 8.41 KB | eiriksm |
#26 | ldap_integration-picture_support-62784-26.patch | 3.11 KB | cgmonroe |
#12 | patch_pictures.patch | 3.13 KB | azuledu |
#7 | patch_pictures.patch | 3.12 KB | azuledu |
Comments
Comment #1
pablobm CreditAttribution: pablobm commentedI'm afraid that feature is not supported at the time being.
Comment #2
pablobm CreditAttribution: pablobm commentedComment #3
hendrakieran CreditAttribution: hendrakieran commentedhi pablo,
thanks for the prompt response. any plan to support this in the near future?
Comment #4
pablobm CreditAttribution: pablobm commentedNot in the short therm. Currently I'm addressing other issues. The most important of them my lack of time lately. Then I'll go through that growing pile of bugs.
I'm not in the position of promising anything now. I'm sorry.
Comment #5
pablobm CreditAttribution: pablobm commentedComment #6
kreaper CreditAttribution: kreaper commentedComment #7
azuledu CreditAttribution: azuledu commentedHi all,
We (plopesc and me) have created a patch to synchronize images from Drupal with LDAP (jpegPhoto attribute).
Can you test it?
Comment #8
azuledu CreditAttribution: azuledu commentedComment #9
azuledu CreditAttribution: azuledu commentedIs there somebody who would like to see this patch ported to the module?
I would like.
Comment #10
djpavlo CreditAttribution: djpavlo commentedI`m interested! Patch work great. Only I'm change it for work with `thumbnailPhoto` for my AD.
Comment #11
dgeo CreditAttribution: dgeo commented+1 :)
Comment #12
azuledu CreditAttribution: azuledu commentedHi all,
A new path version with improvements for multisites.
We hope to see it merged into the module!
Thanks,
Plopesc & Azuledu
Comment #13
acecombat CreditAttribution: acecombat commentedHi,
Azuledu; I tried your new patch but it isn't working for me. I may have done something incorrect but after applying the patch, I go into LDAP > Data and there's a new "Picture" field there. I entered "jpegPhoto" without the quotes, where jpegPhoto is the LDAP attribute containing the hex stream of the image in our directory. Drupal is set to only refresh LDAP data on login, so I logged out and in again and get an error "can't open file". If I refresh the page it has logged me in but no image exists in the user profile page.
Have I done something wrong or is it a bug?
We're using AD on Server 2008 for our directory server.
I can browse and view the hex stream of the image with LDAP Explorer fine.
Comment #14
azuledu CreditAttribution: azuledu commentedHi Acecombat,
I think your steps are correct. The only difference whit my installation is that I configure LDAP to refresh data "every time user object loaded in Drupal" and I'm using OpenLDAP on Ubuntu Server.
Maybe you can try in other way. Create an LDAP user without jpegPhoto attribute, login with this user into Drupal and add the user picture from Drupal. Check that the picture is on LDAP.
Tell me if it works.
Comment #15
StephenRobinson CreditAttribution: StephenRobinson commentedAnybody trying this with Drupal 6? Got profile attributes and roles working from LDAP, just need the images now,
Stephen :)
Comment #16
azuledu CreditAttribution: azuledu commentedThe patch in #12 is for Drupal 6
Comment #17
StephenRobinson CreditAttribution: StephenRobinson commentedsubscribe
Comment #18
StephenRobinson CreditAttribution: StephenRobinson commentedI added this to the "PHP to filter attributes:" textarea and it works:
Comment #19
bverc CreditAttribution: bverc commentedSangersDrupalDude's solution in step #18 works almost flawlessly. I was getting a bug with non-ldap users logging in and getting pics that arn't theirs but rather with the most recent ldap user created. However this may have been a bug in my setup though. But overall it works great.
I have also moved the code out into a hook_user function in a module I was developing at the time. This is good because it stores the code on the file system rather than in the database. And also fixes my wrong image problem.
Comment #20
verta CreditAttribution: verta commentedSubscribing, I can see we will need this.
Comment #21
anoldaccount CreditAttribution: anoldaccount commentedSubscribing. Will be looking to make this work with Drupal 7 and Commons. Thanks.
Comment #22
verta CreditAttribution: verta commentedPer # 18 and # 19, would it be appropriate to set $attributes[thumbnailPhoto][0] to null at the end of the snippet?
(as it sounds like the variable is not being deallocated/reset)
Comment #23
verta CreditAttribution: verta commentedI tried the code in #18, but it's not doing anything and I get the following error in the site log:
Duplicate entry '' for key 'name' query: INSERT INTO users (picture, created) VALUES ('', 1300374617) in user.module on line 327.
Comment #24
johnbarclay CreditAttribution: johnbarclay commentedSo what is the status of the patch in #12? Does it work and has anyone tested it or refined it?
Comment #25
azuledu CreditAttribution: azuledu commented@johnbarclay: We are using it on our web page without problems. It works for us.
Comment #26
cgmonroe CreditAttribution: cgmonroe commentedHere is a GIT patch against the current 6.x-1.x branch based on the earlier patch. It has the following improvements:
- Uses the "user_picture_patch" directory instead of assuming the default 'pictures' directory
- Only shows the "picture" field in the ldapdata server setup screen if user pictures have been enabled.
- Does not "die" on file errors. Instead will ignore the picture entry and issue a watchdog warning.
- Does not have hard coded jpegphoto attribute in LDAPInterface.inc (does not make any changes here).
- Has support for (modified) avatarcrop module
Notes:
The current version of the LDAPInterface.inc seems to handle deleting binary data without the original patch change. But this probably should be checked against other LDAP servers (Tested against ApacheDS server).
The support for the avatarcrop module needs to have the following changes made in the avatarcrop.module file.
In the cropUserPic_submit function the drupal_goto('user/'.$uID.'/edit') statement needs to be changed to a $form_state['redirect'] call. E.g:
In the cropUserPic() form function, a new 'change_pic_uid' form value to work. E.g.: add these to the form.
Patch with some other changes to be submitted to avatarcrop project soon.
Comment #27
johnbarclay CreditAttribution: johnbarclay commentedthere are so many patches that need review in the ldap integration issue queue that I would suggest everyone who has a patch review 2 or 3 other patches. Then the people using this module for the first time won't have to wade through so many patches.
Maybe we could even have a release candidate at some point or at least another beta.
Comment #28
eiriksmHey. Great work!
Just tried the patch in #26. It does not have the closing bracket for the function _ldapdata_user_load, so it does not work. Attached is an updated patch which works for me (and I also did some rewriting of the indentation and stuff to follow drupal coding standards. And just for that function as well.)
Anyway, awesome new feature. Would love to see the feature commited. Keep up the good work!
Comment #29
eiriksmDarn it, forgot the patch. here it is.
Comment #30
cgmonroe CreditAttribution: cgmonroe commentedThis is has now been committed to the -dev version.
A couple of things to note:
If user pictures are enabled in the system, the ldapdata module will add a "Remove picture upload and delete fields from user edit form" checkbox to the LDAP UI settings (in ldapauth). The help text for this explains that this is there since if ldapdata is configured to do a read/only sync of pictures, these option will not work and probably should be removed.
One of the best attribute to use for user pictures is the "photo" attribute (part of InetOrgPerson I think). This is preferable to the "jpegPhoto" attribute because it allows any type of image. With the jpegphoto attribute, some servers will issue an "Invalid Syntax" or similar message when a non-jpeg is uploaded and AFAIK there is no easy way to tell the core user pictures to limit the type of images allowed.
Comment #32
ozhovnir CreditAttribution: ozhovnir commentedI've successfully mapped the Active Directory thumbnailPhoto attribute to Drupal's picture attribute, but how do I go about changing the dimensions of the image. Currently the picture imported needs to be scaled down some. Thanks.