Re: Imagepng does not work: Browser says Document contains no data.
| From: | Matt McClanahan | Date: | Sat, 21 Oct 2000 06:59:53 +0000 |
| Subject: | Re: Imagepng does not work: Browser says Document contains no data. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-21530@lists.php.net to get a copy of this message | ||
On Sat, 21 Oct 2000, Paul Aschenborn wrote:
> Does anyone of you has an idea what else I might have missed to do ?
>
> Thanks a lot
>
> --
>
> <?php
> header ("Content-type: image/png");
> $im = @imagecreate (50, 100)
> or die ("Cannot Initialize new GD image stream");
> $background_color = ImageColorAllocate ($im, 255, 255, 255);
> $text_color = ImageColorAllocate ($im, 233, 14, 91);
> imagestring ($im, 1, 5, 5, "A Simple Text String", $text_color);
> imagepng ($im,"/tmp/img.png");
> ?>
You don't need to save it to a temp file if you want to output it to the
browser. Simply saying imagepng($im) will suffice.
Matt