Usually you store file path/name in the database, not the file itself. Some argue that they want it stored in the db and not the file system, but since your database is stored in a file you are either way storing the images in the file system 
I’d suggest moving them, it’s much easier to let the db and the file system do what they were made for.
if you can’t then you must create a php script that displays an image like getimage.php?id=23897, then fetch the id from the database, set header type to image, and output the image.
you can then use this on your site like
[php]
[/php]