If your web server is running Apache, you can use .htaccess to prevent people from loading images in their browser by entering the full URL in the address bar.
For an explanation of what the .htaccess file is all about and how to use it, read the article here:
http://www.javascriptkit.com/howto/htaccess10.shtmlThis part of the article talks about hot linking but it will serve your purpose.
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?YourWebSite.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ - [F]
That code will instruct the Apache web server to return a "403 - Forbidden, access denied" error page back to the user should they try to access the image file directly.
HERE'S THE CATCH:The user can always dig through their browser's cache and locate the file given to them by details.php. They might also use a web site copier tool, or...... there are several other ways of getting the image. So basically, the .htaccess approach will only work if you had a download image different from than the one served up by details.php
My two cents: I'm not at all in favor of storing the images in the database itself. It would introduce performance issues.