image - php imagegif() direct output fails but indirect output works -


i have php script supposed create , display image.

the image displayed on webpage when using code:

header('content-type: image/gif'); readfile('picture.gif'); //rest of code creating image imagegif($im,'picture.gif'); 

but, image not displayed when using code:

header('content-type: image/gif'); //rest of code creating image imagegif($im); 

in php documentation imagegif, code given example:

<?php // create new image instance $im = imagecreatetruecolor(100, 100);  // make background white imagefilledrectangle($im, 0, 0, 99, 99, 0xffffff);  // draw text string on image imagestring($im, 3, 40, 20, 'gd library', 0xffba00);  // output image browser header('content-type: image/gif');  imagegif($im); imagedestroy($im); ?> 

what doing wrong?


Comments