Re: [PHP] LDAP specific?

2002-11-14 Thread Tony Earnshaw
tor, 2002-11-14 kl. 11:50 skrev Krzysztof Dziekiewicz: <

> You can not put any html code with image code.
> If you send some html you mean to send
> header("Content-Type: text/html")
> with
> header("Content-type: image/jpeg")
> Where do you want go to ?
> 
> You can do so:
> There is on the page http://xxx/user.html?name=smith some html code where a user can 
>act.
> Among the html code you insert http://xxx/userfoto.html?name=smith";>
> On http://xxx/userfoto.html you send  header("Content-type: image/jpeg") and the
> image content and no html code.

tor, 2002-11-14 kl. 09:20 skrev BigDog: <

> I create a php page that gets the image and sends the correct header. 
> Then in my other php page that displays the details about a user i
call
> . Then in showperson i send
the
> correct image headers and the image is displayed properly.
> 
> HTH...
__

These are the answer. Bless you both, pretty sirs.

Best,

Tony

-- 

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





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] LDAP specific?

2002-11-14 Thread Tony Earnshaw
tor, 2002-11-14 kl. 11:14 skrev Chris Hewitt:

> The headers must be the first thing that is sent to the browser. Do all 
> your other html afterwards, or use output buffering.

Please nobody else bother, it's my own stupid fault for not knowing
enough.

I'm halfway there, output buffering will prove to be the answer and like
everything else with PHP it's a question of reading and practicing. I'm
an OS man rather than a programmer.

Best and thanks,

Tony

-- 

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





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] LDAP specific?

2002-11-14 Thread BigDog
This is how I do it.

I create a php page that gets the image and sends the correct header. 
Then in my other php page that displays the details about a user i call
. Then in showperson i send the
correct image headers and the image is displayed properly.

HTH...

On Thu, 2002-11-14 at 10:50, Krzysztof Dziekiewicz wrote:
> > 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 ';, print '';
> > etc, *anywhere*, I get a "headers already sent" error.
> 
> You can not put any html code with image code.
> If you send some html you mean to send
> header("Content-Type: text/html")
> with
> header("Content-type: image/jpeg")
> Where do you want go to ?
> 
> You can do so:
> There is on the page http://xxx/user.html?name=smith some html code where a user can 
>act.
> Among the html code you insert http://xxx/userfoto.html?name=smith";>
> On http://xxx/userfoto.html you send  header("Content-type: image/jpeg") and the
> image content and no html code.
-- 
.: B i g D o g :.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] LDAP specific?

2002-11-14 Thread BigDog
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 ';, print '';
> 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.
> 
>  
> // Code to show a jpeg from an attribute sent on a previous page
> // $headers = getallheaders();
> // foreach ($headers as $name => $content) {
> //echo "headers[$name] = $content\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




Re: [PHP] LDAP specific?

2002-11-14 Thread Tony Earnshaw
tor, 2002-11-14 kl. 11:14 skrev Chris Hewitt:

> >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 ';, print '';
> >etc, *anywhere*, I get a "headers already sent" error. So I can't

> The headers must be the first thing that is sent to the browser. Do all 
> your other html afterwards, or use output buffering.

Thanks for the answer, Chris. I realise this, but that just does not
work - been there, seen it, done it.

Wherever (even as 1st line) *any* PHP4 header stuff is put in the
script, adding html code later results in the same "headers already
sent" error. That's why I asked for a "workaround," by name.

Best,

Tony

-- 

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





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] LDAP specific?

2002-11-14 Thread Krzysztof Dziekiewicz
> 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 ';, print '';
> etc, *anywhere*, I get a "headers already sent" error.

You can not put any html code with image code.
If you send some html you mean to send
header("Content-Type: text/html")
with
header("Content-type: image/jpeg")
Where do you want go to ?

You can do so:
There is on the page http://xxx/user.html?name=smith some html code where a user can 
act.
Among the html code you insert http://xxx/userfoto.html?name=smith";>
On http://xxx/userfoto.html you send  header("Content-type: image/jpeg") and the
image content and no html code.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] LDAP specific?

2002-11-14 Thread Chris Hewitt
Tony Earnshaw wrote:


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 ';, print '';
etc, *anywhere*, I get a "headers already sent" error. So I can't


The headers must be the first thing that is sent to the browser. Do all 
your other html afterwards, or use output buffering.

HTH
Chris


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] LDAP specific?

2002-11-14 Thread Tony Earnshaw
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 ';, print '';
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.

 $content) {
//echo "headers[$name] = $content\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





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php