Multiple images' data in one field

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
danielw1
Forum Newbie
Posts: 6
Joined: Sun Jan 05, 2003 12:54 pm
Location: Kansas
Contact:

Multiple images' data in one field

Post by danielw1 »

Currently I'm working on a script for storing the binary information of images for news stories in a database (as opposed to a directory). I'm wanting to be able to store multiple images in one field in the table (BLOB vartype, MySQL database). My idea would be to set a form of pipes to be able to parse off the images... i.e.

imagedata<PIPE>imagedata<PIPE>imagedata

And have <PIPE> be some specific spelling that wouldn't naturally occur in an image's binary data.

Would this work? Is there any other way, without using a directory? I wish that MySQL had dynamic array creation support, but alas... it does not. :)
fractalvibes
Forum Contributor
Posts: 335
Joined: Thu Sep 26, 2002 6:14 pm
Location: Waco, Texas

BLOBs

Post by fractalvibes »

I think you should store each image separately, otherwise you may have a mess.

Just have an ID column in the image table that serves as a "foreign key"
relating back to the key of the news story stored in another table.

Also, capture and store the content-type of the image.

Phil J.
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

enter the theory of relational databases. setup another table for all your article images. along with a uniqe ID set a field to articleID (or whatever) and when you go to get all the images for an article just select all images where articleID is equal to the article you want.
User avatar
DaZZleD
Forum Commoner
Posts: 38
Joined: Tue Jan 07, 2003 5:39 am

Post by DaZZleD »

can you point me to a certain site for documentation regarding MySQL and relational databases (as the manual doesn't discuss this part, just mentions it)
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

here's a tutorial/article on webmonkey that i like: http://hotwired.lycos.com/webmonkey/99/13/index1a.html
Post Reply