Is there a way, on the server, to tell if a request for an image like:
http://www.myserver.com/test.jpg
is a direct request (entered in browser address bar), or as a result of an image tag?
<img src="http://www.myserver.com/test.jpg" alt="blah blah">
You could check the Referer
field in the request to identify whether or not the image was requested directly or was referred by another page; however, this won't allow you to differentiate between an embedded image and a linked image.
Edit: Also, as noted by tmuguet, it is extremely easy to spoof or obscure the referer in a request.
No, it's not possible to differentiate. Both will be requested by the browser in the same way