You are sending a Content-Type header to say the image is a png, but you are saving it with imagejpeg, this may not be causing your problem but it certainly won't help. Trying using imagepng instead. Another thing that would cause problems is if you have display_errors and error_reporting set. If an error occurs the error message will appear in the image. Try saving the image to file, opening it with a text editor and look for an error message at the start of the file.