The issue of putting images into a MySql database is not so black and white as some posters would suggest. The original reference to not putting images into the MySql databases no longer exists in the MySql documentation.
Having said that,
a) using a blob, text or varchar field in a table automatically gives you a variable record length. If a variable length record is updated, it is not written back to the original location, but to the end of the database. Thus, the database grows and key trees may need to be split. Thus: if you do a lot of updates, blobs, texts (or varchars) will cause your db to grow and slow down. If you update only infrequently, or dump and rebuild a table, then this is not an issue.
UPDATE: I have to correct myself here. According to the comparision page between MySql and PostgreSQL (
http://www.mysql.com/documentation/mysq ... PostgreSQL), MySql automatically recaptures lost space created with updates of variable length records. It says you nver need to run maintenance on a MySql database. If true, then a) is a non operational reason for not using blobs.
b) room must be made in memory for all the records that are selected in a query. If you have large blobs, and you retrieve a bunch of records at once, you will use a bunch of memory. There is a page on the MySql site that describes how memory is used...
http://www.mysql.com/documentation/mysq ... Memory_use. So, if you have small images (like thumbnails) or retrieve only a handful of records, then you won't have a problem.
So, worst case scenario is you load up a db with 10,000 2 megabyte images, update them continuously through the day, and read 1000 of them at a time with a SELECT statement. I expect you will be real unhappy.
But, create a db with a couple of thousand entries, limit the blob size to something reasonable, reduce or eliminate real time updating, and control the number of records returned in a SELECT and it will work just fine.
This URL shows how to add images to a database.
http://www.phpbuilder.com/columns/florian19991014.php3
I wrote a photo gallery app that I use for my photos and is derived in part from florian's code (I found all the gotchas with image display). This app uses thumbnail images which are stored in the database (which is actually derived from a Thumbsplus database), and it uses a text field (another blob) for the photo annotation. Actual photos are stored as files external to the databse... it is a hassle to load a 1000 photos.
If you want the scripts for this site, email me. There are three, one of which is a bit long to post here.
http://www.herbhost.com/seasia/