I'm trying to produce a "book of mugs" (a 'mug' is a 'face') for people
at work to be able to manage and change, as far as they are allowed to,
their own personal details in the org's directory database.

It's based on PHP 4.2.3/Apache and Openldap 2.1.8 and above and/or
Novell eDirectory NLDAP 8.0 or above.

One of the things I have to do, is show and change jpeg photos from the
user's browser. Browsers are the latest IE, Netscape or Mozilla. No
problem with that, only a problem with the following (Code sample

I can show a jpeg using a href with a target, either in a new page or a
frame. To do this, PHP needs to be fed 'header("Content-type:
image/jpeg")'. This can be put more or less anywhere in the very short
script used for showing the jpeg and works. However, if I try to put any
more html code into the script, i.e. 'print <html>';, print '<body>';
etc, *anywhere*, I get a "headers already sent" error. So I can't
include code for changing the BGCOLOR, sizing the image or anything like

Anybody know a workaround? I've cheesed as much code as i can from the
recoginized tools, such as LDAPExplorer, John Hallam's magnificent yet
not widely known contrib. and the Wrox books, but none of them even
attempts to address what I want.



P.s., thanks for what is probably the most *patient minded* and catholic
mailing list on the Internet, and all the good advice.


// Code to show a jpeg from an attribute sent on a previous page
// $headers = getallheaders();
// foreach ($headers as $name => $content) {
//    echo "headers[$name] = $content<br>\n";
// }

$ds=ldap_connect($Host, $Port);

if ($ds)  {

  if ($r) {
    @$these_attrs = array($Attribute);
    @$result = ldap_search($ds, $BaseDN, $target, $these_attrs);
    if ($result) {
      @$result_id = ldap_first_entry($ds, $result);
      if ($result_id) {
        @$foto=ldap_get_values_len($ds, $result_id, $Attribute);
        print $foto[0];


Tony Earnshaw

Cricketers are strange people. They wake up
in October, only to find that their wives had
left them in May.

e-post:         [EMAIL PROTECTED]

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to