20121218 loading jpegs with ldapmodify - plembo/onemoretech GitHub Wiki

title: Loading jpegs with ldapmodify link: https://onemoretech.wordpress.com/2012/12/18/loading-jpegs-with-ldapmodify/ author: lembobro description: post_id: 3837 created: 2012/12/18 17:32:48 created_gmt: 2012/12/18 21:32:48 comment_status: closed post_name: loading-jpegs-with-ldapmodify status: publish post_type: post

Loading jpegs with ldapmodify

Just a quick note on how to do this. The man page, as usual, is not a literary masterpiece. First, very important. If you've converted your image file from another format do yourself a favor and pass the resulting jpeg through a good image manipulation tool like the GIMP. Badly executed conversion will result in encoding errors during the import process. Here's what your sample LDIF will look like:

# File loadphotos.ldif
dn: uid=rkimball,ou=people,dc=example,dc=com
changetype: modify
add: jpegphoto
jpegphoto:< file:///data/tmp/rkimball.jpeg

dn: uid=crood,ou=people,dc=example,dc=com
changetype: modify
add: jpegphoto
jpegphoto:< file:///data/tmp/crood.jpeg

Here's the command line:

ldapmodify -h ldap.example.com -D "cn=directory manager" -w xxxxx 
-f loadphotos.ldif

That's pretty much it, except remember to keep your images as small as possible (that means lower res than most people are going to like) because LDAP entry size will affect search performance (most web applications actually store the photo on the file system and use a custom attribute in each entry to store a link to the location that photo can be found).

Copyright 2004-2019 Phil Lembo