note 79660 deleted from function.imagecreate by felipe
| From: | felipe@php.net | Date: | Sat, 15 Dec 2007 15:54:51 +0000 |
| Subject: | note 79660 deleted from function.imagecreate by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133587@lists.php.net to get a copy of this message | ||
Note Submitter: DaveAtREMOVEMELeetcrewcrsDotCom
----
There was a comment where some one left code for using the image generator with a URL var. (example:
domain.com/image.php?t=YourTextHere)
He used $t as the variable, but unless previously defined, PHP wont recognize that. You have to use
$_REQUEST['t'] as the variable so it will input the string you entered in the URL.
<html>
<head></head>
<body>
<?php
$im = @imagecreate(128, 16) or die("Cannot Initialize new GD image stream");
$bc = imagecolorallocate($im, 238, 238, 238);
$tc = imagecolorallocate($im, 0, 0, 0);
imagestring($im, 1, 5, 5, $_REQUEST['t'], $tc);
imagepng($im,"im.png");
imagedestroy($im);
?>
<img src="im.png" border="0">
</body>
</html>
Try it now ;)