I would instead add something like this to your html page:
<?php
$query = 'SELECT MAX(id) FROM table LIMIT 1';
$exec = mysql_query($query);
$id = mt_rand(1, mysql_result($exec, 0));
?>
<img src="image.php?id=<?php echo $id; ?>" alt="Random text generator" />
<input type="hidden" name="id" value="<?php echo $id; ?>" />
Then, you'd modify your image.php script a bit:
$id = (isset($_GET['id']) ? intval($_GET['id']) : 1);
$query = "SELECT image FROM table WHERE id >= $id LIMIT 1";
Why? Well, obviously, this solves the problem of the HTML page somehow figuring out what ID the image.php script chose.
Furthermore, this gets rid of the ORDER BY RAND() in your query. This type of ordering statement shouldn't be used (okay, there are exceptions, but for 95% of the time...) since it isn't scalable. There's a topic in this forum regarding this bad coding habit if you're interested in more information.