That is absolutely correct. However, I'm clever.
I have the same code in my Avatar.
I wrote a php application that returns a jpeg (basically piping a random jpeg from a directory) and changed my web server to run any file ending in .jpeg (not .jpg) as a PHP application. This forum sees the jpeg as a picture and has no problems with that. It's got the right mime type and everything. It is, to all intents and purposes, a jpeg. The hard bit is configuring the web server to force clients not to cache it, otherwise they load one version and it stays in their cache.