Reply to Re: Storing images instead of image paths in DB

Your name:

Reply:


Posted by Erwin Moller on 08/04/05 14:14

bissatch@yahoo.co.uk wrote:

> Hi,
>
> I am currently writing a news admin system. I would like to add the
> ability to add images to each article.
>
> What I have always done in the past is uploaded (using a form) the
> image to a folder on the server and then in the database table that I
> INSERT the news article, I'll store the path of the uploaded image.
>
> To me this seems a bad idea as if the image paths were changed on the
> server (cant think why, but still worth considering) the database
> wouldnt reflect this.
>
> The other alternative would be to store the images in the database.
> This way the images and the image path wouldn't be two seperate
> entities. Is this is preferred option? If so, where can I learn more?
> Also, the databases I am using is PostgreSQL (this cant change). Does
> this support storing data entries?

Well, why should you WANT to change from PostgreSQL?
It is a great robust database, and free.
Keep using it. :-)

And I never understood why people like to store images in databases, when
you can much more easily store them in a directorystructure.
Images only make your databasefiles much larger, and offer no extra
functionality.
(Unless you think that 'storing images in database' is the extra
functionality.)

you can easily achieve the same functionality by only storing the name (and
maybe path) of the image in the database.

So my advise: Don't. Just store the path to the image in the database.

One possible problem you might encounter is the fact that if more people can
upload images, you overwrite files with the same name.
So do not let the client choose the name of the image, be sure you pick it.
eg:
<articleid>_img.png
or
<articleid>_img.jpg

Just my 2 cents.

Regards,
Erwin Moller

>
> Any suggestions would be much appreciated, thanks
>
> Burnsy

[Back to original 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

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