On 29/3/04 1:09 pm, jehan.procaccia <[EMAIL PROTECTED]> wrote:
Hello, I am trying to retrieve jpegPhotos from my openldap directory with Net::Ldap, however I keep getting files containing only "data" and not a jpeg files. I took inspiration from: http://search.cpan.org/src/GBARR/perl-ldap-0.31/contrib/jpegDisplay.pl here's the section of code I took:
$photo=$entry->get_attribute( 'jpegPhoto' );
That really ought to be:
$photo=$entry->get_value( 'jpegPhoto' );
really ? I took that example from GBARR , I though it was correct with get_attribute, no ?
If you run the script with 'use warn;' you will see why.oops ; Can't locate warn.pm in @INC :-(
if(ref($photo)) {$picture = @$photo[0];} else {print "\n"; print "No jpegPhoto attribute for DN: $dn\n";} open (TMP, ">./photos/$mail"); $| = 1; print TMP $picture; close(TMP);
$ file photos/[EMAIL PROTECTED] photos/[EMAIL PROTECTED]: data which cannot be viewed as a jpeg photo :-(
What I am doing wrong ?
Is there a difference between the value you retrieved and the value in the file (ie is writing to the file going wrong)?
from my perl script I get binary data apparently: $ more ./photos/[EMAIL PROTECTED] ���� .....
from ldapsearch I get ASCII ? encoding problem ? utf8 ?
$ ldapsearch -x uid=procacci -D "uid=procacci,ou=people,dc=int-evry,dc=fr" -W jpegphoto -h ldap1 -LLL
Enter LDAP Password:
dn: uid=procacci,ou=People,dc=int-evry,dc=fr
jpegPhoto:: /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODw
wQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhY
$ od -s ./photos/[EMAIL PROTECTED] 0000012 JFIF 0001506 qGjP( 0002446 v)i 0004503 _J^! 0005063 Jn( 0005370 <ay
A jpeg that works fine:
$ od -s /home/jehan/jehan.procaccia.jpg 0000006 JFIF 0005704 SHE%- 0015447 psL^.
Yes no problem with that, mozilla (ldap://...) and a PHP application show them correcltyAre the JPEGs being *added* correctly to the server? Are any other clients able to read the JPEGs?
Anyone got a sample perl script that retrieve jpegphoto working ?
Thanks.
Cheers,
Chris
Cheers,
Chris
