You are here: Re: Storing images instead of image paths in DB « PHP Programming Language « IT news, forums, messages
Re: Storing images instead of image paths in DB

Posted by Norman Peelman on 08/05/05 04:19

"Andy Hassall" <andy@andyh.co.uk> wrote in message
news:el55f1lh4mvbe0f7f7spotlgn2i9lna32d@4ax.com...
> On Thu, 04 Aug 2005 23:54:11 +0300, Alexey Kulentsov
<crimaniak@crimaniak.com>
> wrote:
>
> >> The other alternative would be to store the images in the database.
> >Never store image in database. Database can't index images so you have
> >no any reason to store it in SQL server.
>
> Untrue - two clear advantages are:
>
> (1) The image data is under the same transactional control as the rest of
the
> data. If your server crashes, then you don't have any guarantee that the
> filesystem is in sync with the database any more. And you can't ROLLBACK a
> filesystem change.
>
> (2) Having the images in the database means you only have to backup one
thing,
> and similar to (1) you know that your image data is referentially correct
> compared with the rest of the data.
>
> There are disadvantages to storing image data in the database, some of
which
> can be alleviated with caching in the filesystem, but to say there is no
reason
> to store images in the database is not true.
>
> --
> Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
> <http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool

I have to agree with Andy on this one... for both reasons he pointed out.
And most of the time you can pull in your image data right along with
everything else in the same query. If you have a small number of images you
would be ok to do it either way and the filesystem method would probably not
be too bothersome but, if you are looking to be storing thousands or more
then you will probably need to programmatically break up the directory
strucure so as to not overload the filesystem (too many files in one
directory can really slow down a filesystem, not to mention the filesystem
limitations) such as alphabetically, numerically, etc. The GD functions
really make this easy by the way.

Norm
---
FREE Avatar hosting at www.easyavatar.com

 

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

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