php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4467 putting image into directory
Submitted: 2000-05-16 05:26 UTC Modified: 2000-08-25 06:05 UTC
From: edu at weisgerber-online dot de Assigned:
Status: Closed Package: LDAP related
PHP Version: 3.0.16 OS: Linux 2.2.14 (redhat 6.x)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: edu at weisgerber-online dot de
New email:
PHP Version: OS:

 

 [2000-05-16 05:26 UTC] edu at weisgerber-online dot de
Hi!

Just tried to put an image into LDAP directory.
---code---
<?
$con=ldap_connect("server",389);
$bind=ldap_bind($con);
$fp=fopen("/path/file.jpg","r");
$image=fread($fp,filesize("/path/file.jpg"));
fclose($fp);
$entry[jpegPhoto]=base64_encode($image);
$r=ldap_modify($con,"cn=someone,o=bla,c=de",$entry);
c=ldap_close($con);
?>
---/code---
This one produces a new (or modified) entry of type jpegPhoto in the directory, but Netscape(4.7) LDAP-client can't read the image.

I use OpenLDAP on the server. an "ldif -b jpegPhoto \ <file.jpg >testldif" produces a base64-encoded image. When i insert this image into directory, everything is OK and Netscape displays the right thing. A quick look at the page source results: ldif and base64_encode() produce different code. Question is: why? and: how ca i insert a jpeg into LDAP using php3?

Package vesions:
Apache 1.3.9
php3 3.0.16 built through DSO with: LDAP,IMAP,GD,MySQL,Postgres,Informix,PDFLib,CLibPDF, Calendar,XML (all dynamic loading) (mail me for SRPM)
OpenLDAP 1.2.9 (as of RH 6.2)
RedHat Linux 6.2 (Kernel 2.2.14)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-25 06:05 UTC] sniper@php.net
Use php4 (from CVS or from snaps.php.net or wait for 4.0.2 to be released soon). And do not base64_encode the image.

--Jani
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC