if I'm understanding correctly, you want the image to display inline with the HTML?
HTML does not have the ability to do this.. so, what you do is call an external script using the HTML tag eg
<IMG SRC='make_my_image.php?image_id=1'>
so, the script's only output is still to the browser, and the image is displayed inline in the page