You are here: Re: Images and PHP « All PHP « IT news, forums, messages
Re: Images and PHP

Posted by fletch on 04/24/06 11:20

Let's think about why you don't want people to know where the folder is
for a second. Presumably this is because you don't want all the images
downloaded by guessing the url. Therefore sticking itemid in the url
makes an equivelence.

If you are having your images uploaded then it would be a simple job to
store the ddetails of the image in a db and call them out when
required.

You could have an image 1.gif and give it the url
/img/{filecode}.gif/as/1.gif

where {filecode} is some random number, perhaps even
itemid-filecode.gif.

Then in the webroot you have a directory called img in which you put a
..htaccess file containing

RewriteEngine On
RewriteBase /img
RewriteRule ^(.*)(/as/)(.*)$ /images/$1
Options -Indexes

The file is then save to /images/{filecode}.gif

The random number prevents easy guessing of image names and the
structure of the url makes the browser theink the file is called 1.gif.


This presumably covers your requirements and means that apache does all
the work without having to use PHP to get the file, which is much more
efficient. Also since the OS is being asked for a file then it's file
caching functions swing in to force meaning the most common images are
likely to be stored in RAM for even quicker delivery.

 

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

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