Page 1 of 1
BLOB field
Posted: Mon Jan 07, 2008 8:48 am
by Arsench2000
Hello world,
Can you please help me.I have a blob field and want to insert and read image, but don't know how to do that.I want to insert data with images into mysql db and then read that in php.
Thank a lot
Posted: Mon Jan 07, 2008 10:42 am
by pickle
Do a Google search for "Storing images in MySQL".
I'd recommend not storing the images in MySQL, but rather store the images in the file system & store the path to the images in the database. There is a lot of overhead when storing images in the database - which leads to slow page loads.
Re: BLOB field
Posted: Mon Jan 14, 2008 5:14 pm
by emmbec
What if instead of images he was storing just regular files, lets say ZIP, or DOC files. Is it still a lot of overhead?
Re: BLOB field
Posted: Mon Jan 14, 2008 5:16 pm
by Luke
Why wouldn't you just store the file in the filesystem... that is, after all, what it's for.
Re: BLOB field
Posted: Mon Jan 14, 2008 5:21 pm
by pickle
emmbec wrote:What if instead of images he was storing just regular files, lets say ZIP, or DOC files. Is it still a lot of overhead?
Ya, there is still overhead. If a request comes in for a file, Apache has to first look at the file and decide what to do with it. If it's just a regular image/zip/doc/whatever file, Apache just opens the file & sends it along.
If it's a file like what the original poster wanted to do, Apache would have to invoke the PHP engine, which would then query the database, which would return the value, which would then stream the file back to the user. Not only is there query and PHP engine overhead, there's also memory overhead because the file has to be stored 3 times (once in the file that is the MySQL database, once in the MySQL result set, and once in the PHP file), rather than just once in the filesystem.