I would like to create a web site with many images. But I would like to protect against direct access to images, e.g. direct links to images without visiting the web site.>
This might be useful: Allow/deny image hotlinking with .htaccess
Edit: One thing to note about this method is that some Browser/AV/Firewall software removes Referer data when you browse, which would cause potentially legitimate users to be treated as hotlinkers.
If your site already uses some kind of authentication or session system, then it would be better to use the method given in @Mark Baijens' answer.
Update: NGiNX rewrite rule to prevent hotlinking:
location ~* (\.jpg|\.png|\.css)$ {
valid_referers blocked mydomain.com www.mydomain.com;
if ($invalid_referer) {
return 444;
}
}