Re: Create Image on the fly
| From: | val petruchek | Date: | Thu, 17 Jan 2002 11:29:54 +0000 |
| Subject: | Re: Create Image on the fly | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-80900@lists.php.net to get a copy of this message | ||
in index.html you write
<img src=aaa.php>
in aaa.php you write
<?php
$im = @ImageCreate (240, 80)
or die ("Cannot Initialize new GD image stream");
$background_color = ImageColorAllocate ($im, 255, 255, 230);
$text_color = ImageColorAllocate ($im, 0, 0, 0);
ImageString ($im, 3, 10, 20, "Some text..", $text_color);
ImagePng ($im);
?>
You have to create separate php script for creating image and then use it in
you html (php) file.
>
> Hi!
> How do I change this if I will use the Image direct in my html-code?
> Do I need to save it first.
> <?php
> $im = @ImageCreate (240, 80)
> or die ("Cannot Initialize new GD image stream");
> $background_color = ImageColorAllocate ($im, 255, 255, 230);
> $text_color = ImageColorAllocate ($im, 0, 0, 0);
> ImageString ($im, 3, 10, 20, "Some text..", $text_color);
> ImagePng ($im);
>
> //this doesn´t work
> echo "<img src=\"$im\" width=240 height=80>";
> ?>
> Thanks in advance.
Valentin Petruchek (aki Zliy Pes)
http://zliypes.com.ua
mailto:val@zliypes.com.ua