Page 1 of 1

Multiple images' data in one field

Posted: Sun Jan 05, 2003 1:48 pm
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. :)

BLOBs

Posted: Thu Jan 09, 2003 12:06 am
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.

Posted: Thu Jan 09, 2003 12:36 am
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.

Posted: Thu Jan 09, 2003 1:45 am
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)

Posted: Thu Jan 09, 2003 11:02 am
by mydimension
here's a tutorial/article on webmonkey that i like: http://hotwired.lycos.com/webmonkey/99/13/index1a.html