[PHP] Displaying images in another page

2001-10-25 Thread Rudi Ahlers

Hi

I would like to setup a banned ad server, and I will need the images to be
displayed in standard html pages, where the users don't have php access.
Thus, they should be able to call up the image from a normal html page, ie:
img align=center border=0
src=http://www.adserv.webonline.co.za/phpads.php3?what=main;

Can anyone give me some tips on howto do this? And any other tips for banner
ad servers would be great as well.
Regards
Rudi Ahlers



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Displaying images in another page

2001-10-25 Thread Matt McClanahan

On Thu, Oct 25, 2001 at 10:30:24PM +0200, Rudi Ahlers wrote:

 I would like to setup a banned ad server, and I will need the images
 to be displayed in standard html pages, where the users don't have
 php access. Thus, they should be able to call up the image from a
 normal html page, ie: img align=center border=0
 src=http://www.adserv.webonline.co.za/phpads.php3?what=main;
 
 Can anyone give me some tips on howto do this? And any other tips for
 banner ad servers would be great as well.

For tips on banner ad services, I'd simply suggest looking over phpAds
and other such apps (See freshmeat.net).

Displaying images in this fashion is fairly simple.

In the html, as you've already provided, set the img src=.. to a
PHP script, possibly with a query string.  Then, your phpads.php3 would
be responsible for outputing the image data, along with the proper HTTP
header to tell the browser that you're sending it an image.

?

// phpads.php3

// Set the appropriate mimetype for the image
Header('Content-Type: image/jpeg');

$filename = '/path/to/file.jpg';

// Output the image data
readfile($filename);

?

That's it.

Matt

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]