You are here: Re: Displaying photos in PHP « All PHP « IT news, forums, messages
Re: Displaying photos in PHP

Posted by Alvaro G. Vicario on 11/19/05 00:59

*** R Padala escribió/wrote (18 Nov 2005 07:23:48 -0800):
> What is the best way to serve the images so that the user wouldn't get
> hold of other images on the webserver?

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:

mime_content_type()
getimagesize()
header()
readfile()


--
-+ Á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
--

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация