MySql or plain simple text file.

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
yorkshireflatcap
Forum Newbie
Posts: 5
Joined: Fri Oct 16, 2009 7:52 am

MySql or plain simple text file.

Post by yorkshireflatcap »

All,

I've been recently reading that to store images onto a database is a no no..... it's best to load images directly from file.

If I follow the database route, then I need to create a simple program to read my images into the database - A bit of a hassle really.... especially if my website expands.

So what I've come up with is to create a type of file that is structured in such a way that I can read it using parse_ini_file. This file holds the names of images and I've created one for each directory - Calling it Thumbs.txt - plus any textual information associated with each image. It works fine, but just wondering if this is the correct approach to

Many thanks.

John
User avatar
akuji36
Forum Contributor
Posts: 190
Joined: Tue Oct 14, 2008 9:53 am
Location: Hartford, Connecticut

Re: MySql or plain simple text file.

Post by akuji36 »

Take a look at this link:

http://hockinson.com/index.php?s=37

Rod
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: MySql or plain simple text file.

Post by califdon »

What is normally done is to store the images in a directory in the web document root, then store the url to each image in the database. Then you can use the url in either an <a href=....> or an <img src=...> element in your web page. There's no need to store the images, themselves, in the database.
Post Reply