Page 1 of 1

MySQL Question - Storing images in database

Posted: Sun Aug 13, 2006 6:31 am
by HormonX
I just came upon a project that i have to redesign and rework a bit. Question i have is how efficient is storing images in a db , previous person used a binary LONGBLOB. I noticed that even with few images there seems to be a lot of overheard. Won't that slow the database, wouldn't it be easier and faster to store these images as files?

If anyone could shed some light on that it would be great.

Thanx

Greg

Posted: Sun Aug 13, 2006 6:45 am
by bmcewan
Personally i wouldn't store any files in that manner.

I would always store the filename and save the physical file in the filestructure.
When initially storing the file i rename it to a random string, first checking to see if that random string already exists, chosing another if it does. Then save the file in the filestructure and the filename in the db.

Posted: Sun Aug 13, 2006 10:23 am
by HormonX
I totaly agree. I wouldn't do that i was just curious if there were any advantages to storing a while image a binary BLOB. As i mentioned above i noticed a lot of issues with the database and that is without too much data being stored. I will see if the customer would want to redo the while structure and start from scratch.

Thanx.