Can't generate image using PHP -


why following code doesn't show image in browser, sees errors?

    <?php header("content-type: image/png"); $im = @imagecreate(110, 20) or die("cannot initialize new gd image stream"); $background_color = imagecolorallocate($im, 0, 191, 255); $text_color = imagecolorallocate($im, 0, 0, 0); $generator = substr(str_shuffle(str_repeat('abcdefghijklmnopqrstuvwxyz0123456789',5)),0,8); imagestring($im, 1, 5, 5, $generator, $text_color); imagepng($im); imagedestroy($im); ?> 

if have a(or multiple) space(s) before <?php cause failure. script works unless have space.

<?php header("content-type: image/png"); //....etc. ?> 

not:

    <?php header("content-type: image/png"); //....etc. ?> 

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -