When using header("Content-Type: $mimeType");
and image____
to generate only an image to the output, be sure to output nothing else, note even a blank line after ?>
. (That can be a difficult 'bug' to track down -- you get no image and no clue as to why.) The general advice is to not include ?> at all here.