the script that generates the image /must not/ output anything but the image-data...
graph.php
<?php
//generate image
/*******************************************
Display image
*******************************************/
header('Content-Type: image/png');
imagepng($im);
/*******************************************
Clean up
*******************************************/
imagedestroy($im);
?>
then just treat the php script that generates the image as an plain image....
display.php
<html>
<head><title>stats</title></head>
<body>
<?php
include ('../includes/header.html');
?>
<image src="graph.php">
<?php
include ('../includes/footer.html');
?>
</body>
</html>
thats it...