Im creating images to output. When I call the final imagegif() I get the usual “the image sdfsdsdf cannot be displayed because it contains errors”. But if I save this image by the 2nd parameter, it DOES result in a valid GIF image! And imagegif() returns true.
Now what?
Im creating images to output. When I call the final imagegif() I get the
Share
Check the output of your script – it sends something else to the browser. Typically it could be error/warning/notice messages, text output from that script or from another one included into it, spaces/new lines or something else (like BOM record in case of UTF encoding in script file) before the
<?phptag.Solution is simple – comment the
header('Content-Type: image/gif');and call script directly (not the page including the images generated by the script). Check for anything before the ‘garbage’ of the binary content of the image file itself.You may need to add
error_reporting(E_ALL); ini_set('display_errors', 1);at the top of the script in case error reporting/display is turned off as well.