header('Content-Type: image/png'); $img = @imagecreatefrompng('christmas.png'); $font = imageloadfont('font.ttf'); $fontcolor = imagecolorallocate($img,255,255,255); imagestring($img,$font,30,5,$countdown,$fontcolor); imagepng($img); imagedestroy($img); Code (markup): It returns an image that "Cannot be Displayed"
You have to set the header after the php code this should work : $img = @imagecreatefrompng('christmas.png'); $font = imageloadfont('font.ttf'); $fontcolor = imagecolorallocate($img,255,255,255); imagestring($img,$font,30,5,$countdown,$fontcolor); header('Content-Type: image/png'); imagepng($img); imagedestroy($img); Code (markup):
which browser you are using ? If you are using IE it wont display the png files. Try in firefox and if it is getting displayed ...
Make PHP tell you about everything on the first line "error_reporting(E_ALL);" Comment out the header() line Remove the error supression symbol (@) Look directly at the URL in your browser A lot of times what is happening is there is an error in one of the functions and the resulting image is currupted by the error messages.