in reply to Returning jpg works, png NOT

Is there anything in the error log or the access log of your web server?

If you run the script on the command line, do you get the binary data of the png printed to your terminal? (you might need to type reset to restore it afterward).