Displaying photos in PHP

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

We are building an internet based application that would allow any one
to purchase online (php generated) reports that include a few

What is the best way to serve the images so that the user wouldn't get
hold of other images on the webserver?  

Thanks in advance,
R Padala

Re: Displaying photos in PHP

*** R Padala escribió/wrote (18 Nov 2005 07:23:48 -0800):
Quoted text here. Click to load it

Keep them in a folder out of the public folder tree and write a download
script to serve them.

If your web is under /home/foo/htdocs you can create /home/foo/pictures and
then write a script that:

1) Check credentials
2) Find picture's file name
3) Send appropriate "Content-Type" header
4) Read file and output it to browser

Some helpful functions:


-+ Álvaro G. Vicario - Burgos, Spain
++ http://bits.demogracia.com es mi sitio para programadores web
+- http://www.demogracia.com es mi web de humor libre de cloro

Site Timeline