The type of script you are talking about should indeed give out a jpg, but that is all. It is not something that is included inside another script.
Let me try to explain it this way...
In writing in HTML, you would include an image using the <img> tag, and point it to a picture file (jpg, gif, png, etc.).
Well, the script you are talking about here takes the place of the image file. In fact, it IS an image, created dynamically by php.
You see, when the browser attempts to access this script, the headers tell the browser that the information it is about to receive is a jpg, and then the php creates the graphical data. If the script is called "rotate.php", then your HTML might look something like this:
<img src="rotate.php?id=50046">
Where id is a reference in a database that includes the path to the original picture, etc. The PHP takes the request and creates a jpg, which it then sends back to the browser to be displayed.
I have used this same method to stream pdf's without disclosing their actual directory on the server (to protect from outside linking). This method can also be used to only allow registered members of a site to access a file, etc., because you can do any PHP processing that you want (like access a database and validate information), as long as the only information you output is the graphical information.
This is the same general concept behind counters, in that they dynamically create an image based on the number that they are trying to display at that particular moment.
In short, the script will output only ONE type of file, in this case a jpg, which a browser can access just as it would any other picture.
HTH
[EDIT: Drat! I type too slow! Oh, well, you got two people's answer rather than just one.]