well this doesn't really answer your question, but why do you want to store image in db? as I know, it's not such a good idea..
Personally i don't think it's such a bad idea, as long as your site isn't visited as much. The reason it's a bad idea is that it's a really slow process reading so much data from a database.
BUT for security reasons, this could very well be a good idea since the only way you can access the pictures, is through a server side language.
If possible, it's better to store images and files over you webroot, and then access them stil through php, this is a quicker way to do it, and you can still stop people from leeching and that kind of things.