To whom does this sound familiar and how did you solve it?
System is Winnt server with IIS4 and PHP4 in CGI mode (phpts.exe)
What is being tried is to show an image with the imagejpeg($im) function.
Same configuration (including php.ini) and exact same script is used at the office for testing and there, as an intranet, it works fine..