PHP: GD - Manual - PHP: Hypertext Preprocessor
In case your script is using output-buffering-functions somewhere, then you have to clear the buffer first ( with ob_clear() ), before outputting an image with a function like imagepng(). And you should make sure that no buffer will get send after outputi...