You are here: Re: Where to store pictures, in DB or in files? « PHP Programming Language « IT news, forums, messages
Re: Where to store pictures, in DB or in files?

Posted by Surfer! on 07/08/06 13:24

In message <jQFrg.79662$eN2.70498@fe67.usenetserver.com>, David T.
Ashley <dta@e3ft.com> writes
>"Richard Levasseur" <richardlev@gmail.com> wrote in message
>news:1152322021.658752.74530@b28g2000cwb.googlegroups.com...
>> Another option would be to name the file after the primary key, or
>> other unique index, of the table.
>
>The reason for the prime moduli directory scheme is that Unix directory
>operations become inefficient beyond a few hundred entries in a directory.

Indeed, AFAIK it starts at the beginning of the directory and searches
sequentially until it finds a hit.. There is no structure of any kind,
unlike the old System 10 / System 25 computers, where the directories
were tree structures and so much more efficient for large numbers of
files.

However there are schemes that people find easier to understand... For
example, Demon's home directory for a user 'picture' will be similar to
/home/p/i/c/picture. What makes it a good scheme IMHO is that the path
can be derived from the user's name..

At present I don't have enough images anywhere for this to be a problem
but I would adopt a similar approach:

$IMGPATH/0 holds images 0 to 99
$IMGPATH/1 holds images 100 to 199

and so on.

So, the database doesn't even need to hold the full path to the file -
the code can easily derive it from $IMGPATH and the file name. Moving
$IMGPATH doesn't involve altering the database contents, and (obviously
I hope) the code to derive the path would be a function or class so that
if you ever re-organise the structure there is only one place to have to
change the code.


--
Surfer!
Email to: ramwater at uk2 dot net

 

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

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