To "save" the image outputted via the GD functions:
Instead of:
ImagePng ($TheImage);
Use:
imagepng($New_Image, 'Filename.png');
imagejpeg($New_Image, 'Filename.jpg');
imagegif($New_Image, 'Filename.gif');
Of course, the directory has to be CHModded 0777 - you can do this as it is happening, or have it static.