Posted by Chung Leong on 07/07/06 21:43
romayankin@gmail.com wrote:
> I'm making some kind of news-board site on PHP (tthat's why I guess
> it's the right place to post the question here). Each entry would
> have a small picture (less then 100kb). Taking into consideration all
> pros and cons the question is where to store these pictures in DB or in
> files?
Keeping images in the database makes them easier to manage. No worry
about duplicate filename. If your database supports cascade delete then
the images are purged automatically when the article is removed. And a
foreign key constraint could guarantee that the images won't go
missing. Keeping them in the database also makes backup easier.
The downside is performance and resource usage. The web server is
extremely efficient at serving static files. Loading an image from the
database is relatively slow, on the other hand, and uses a good chunk
of memory.
[Back to original message]
|