Re: GD Library and outputing image
| From: | tedd | Date: | Fri, 15 Jun 2007 22:56:54 +0000 |
| Subject: | Re: GD Library and outputing image | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-257150@lists.php.net to get a copy of this message | ||
At 9:17 PM +0100 6/13/07, Ross wrote:
Never really used the GD much before very straightforward but how do I output the image on a page. This is fine on a php page on its own but what about one where the headers are already sent?Ross: That's not a problem. See this: http://xn--nvg.com/rotated_text <-- if your browser chokes, get a better browser The image code (text.php) is: <?php Header ("Content-type: image/gif"); $im = imagecreate (150, 150); $background = ImageColorAllocate ($im, 238, 238, 238); $text_color = ImageColorAllocate ($im, 00, 51, 102); //#036 00 33 66 HEX ImageTTFText ($im, 20, 45, 30, 130, $text_color, "arial.ttf", "Hello World..."); ImageGif ($im); ImageDestroy ($im); ?> and it's called from html like this: <img src="text.php"> If you put this into your site, you'll need arial.tff to make it work, but you can find it in lot's of places. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com