First off, I said to use setTimeout before, and while it can be handle by that, what you want is setInterval.
Generally, you run php scripts either through CLI (command line interface) from which any output to screen is text, or through a browser by sending a request to a web server, from which the type of output may vary, so an image is just one of many possibilities.
The way a browser handles images is they either
1. Get an image resource directly in the adressabar (e.g. somplace/someimage.jpg), and it reasonably expects to get just one image.
Or
2. It reads (X)HTML, finds an <img src="someplace/someimage.jpg"> element, then sends a new get request to the webserver for this image (just as it would have done in the first case), and reasonably still expects one image.
Best stop for javascript documentation in my opinion.
All things (X)HTML, CSS etc
Add an id attribute to your img element, and starting inside the head element:
<script type="application/javascript">
function setSrc() {
var d = document;
var t = new Date();
t = t.valueOf();
var i = d.getElementById('yourImageId');
i.src = 'http://www.example.com/randomimage.php?t';
}
</script>
</head>
<body onload="window.setInterval('setSrc();', 1000);">