Here's an idea that may work, although I've not really thought it through too much, and haven't tried it:
- Server receives a request for a page.
- Generate page content in PHP, using a one-time-key (OTK) that refers to the image. The OTK could be stored in a session variable or a database.
- When the client renders the page, the server receives a request via a query parameter for the image, using the OTK. Supply the image and delete the OTK.
For example, instead of:
<img src="www.mysite.com/mypage/myimage.jpg">
...generate a one-time-key and store that in a lookup table, so that it refers to your image:
4e33fd162fe95 => image.jpg
...then generate your page using that OTK instead:
<img src="www.mysite.com/mypage?image=4e33fd162fe95">
When the server receives a request for that image, send the image, and delete the OTK. This means that every request for the page generates a new OTK. Trying to use that URI for the image again will not work.
This has some obvious caveats in terms of performance, as client-side caching would no longer work, and it will place some overhead on the server. There are probably other caveats too.