Page 1 of 1

Image display for news articles

Posted: Fri Dec 05, 2003 6:25 am
by hairyjim
(Sorry if it is in the wrong forum)

Hi,

Im new to PHP so go easy!

I have created a MySQL database to store news articles with the following fields.

Title, Date, main article, smlImg, lgeImg

I created a script which lists all articles and then turns the title into the click through for the main detail. I want to display the image referenced in the db.

Now this is where my Q lies. Do I store the full path to the image in the DB or should I store only the name and create an image path variable in my detail page file?

What is the best practice solution?

Posted: Fri Dec 05, 2003 9:32 am
by microthick
If all of the images will be stored in one folder, or a folder you can construct from other variables, then I would create a path variable and only store the filename.

Posted: Fri Dec 05, 2003 9:47 am
by JayBird
just storing the filename makes your application more flexible, if say you wanted to change the path of the images at a later date

Mark

Posted: Fri Dec 05, 2003 11:16 am
by hairyjim
Thanks guys.

I did think it was perhaps the best way to do this just getting confirmation makes for more confidence in what I am trying to achieve.

:D