Why can u not do a page that displays the images as img src? That should work for ya...instead of sending the headers. Are u saving the image in the ldap server?
On Thu, 2002-11-14 at 09:27, Tony Earnshaw wrote: > People, > > 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 > below): > > 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 > that. > > 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. > > Best, > > Tony > > P.s., thanks for what is probably the most *patient minded* and catholic > mailing list on the Internet, and all the good advice. > > <?php > > // 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) { > @$r=ldap_bind($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); > header("Content-type:image/jpeg"); > 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] > www: http://www.billy.demon.nl > > -- .: B i g D o g :. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php