You need to send the correct header for the content-type of the image. If the image is a .gif file, you need to send:
Header("Content-type: image/gif");
Likewise, if it were a jpeg, it would be:
Header("Content-type: image/jpeg");
I hope that helps!
Chris King