Are you for-sure wanting to store images as blob data in the database? Or would storing it in the filesystem be an option?
There are pros and cons to both, but I've always tended to believe that the benefits of storing in the filesystem outweigh the benefits of storing in the database.
For a good example of doing this, I'd recommend looking at the code for qcodo.com, itself.
Images (and uploaded file assets in general) are stored in a very clean, consistent way, with ties back to the database.
You can take a look on the repository on github -- specifically at the code dealing with uploaded images in the wiki (the WikiImage object) as well as uploaded images for the Showcase (the ShowcaseItem object).