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' );

If you run the script with 'use warn;' you will see why.

>   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)?

Are the JPEGs being *added* correctly to the server? Are any other clients
able to read the JPEGs?

Cheers,

Chris

Cheers,

Chris

Reply via email to