PHP as a stand-alone Image server

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
soul8o8
Forum Newbie
Posts: 4
Joined: Wed Aug 11, 2004 6:47 am

PHP as a stand-alone Image server

Post by soul8o8 »

Yo!

I want an apache/php server to act as an image server for other web sites.
I.e they (the other websites) can write in their html-file:

<img src="myL33tImageServer.net/getImage.php?login=user&file=weather.gif" etc etc>

-- And my server will send an image.

Now, Is that possible? Can a PHP-script send itself as an image? Or is there any other, preferably better, solution? We can assume that the "client" websites have php as well...

The thing is the images get created at runtime and on request so i dont want a regular

<img src="mywebsite.net/image_1234.gif">

I need php inbetween :) How?


(im new here, let me know if there's an initiation ritual ;)

hi-5!
/soul8o8
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

yes, php can pass images with the gd functions, or reading them like a download functionality to the requestor..

The only major thing your php would need to do is change the content-type being sent to the browser, so the browser knows how to read it.

Code: Select all

[php_man]header[/php_man]('Content-type: image/jpeg');
for instance...
Post Reply