First, forget about storing the images in the database. It just slows you down and serves no purpose.
Just handle the uploads as described in the manual, and save the files in some directory.
Then store the location of that file in the database.
Then a simple way to get the image would be to store the images in a subdirectory in the documentroot, and print the location you got from the database.
A more 'secure' method:
PHP has access to your complete filesystem (as long as the webserver user has read rights) so you can store the files anywhwere, even outside your documentroot.
Then you can use a simple script to serve the images from that secure location.