note 29485 added to function.imagestring
| From: | php dot net at mvoncken dot nl | Date: | Fri, 14 Feb 2003 20:18:42 +0000 |
| Subject: | note 29485 added to function.imagestring | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-43954@lists.php.net to get a copy of this message | ||
A simple example:
To make one line of text fit in the image.
<?php
header ("Content-type: image/png");
$string = "spam@mvoncken.nl";
$font = 4;
$width = ImageFontWidth($font) * strlen($string);
$height = ImageFontHeight($font);
$im = @imagecreate ($width,$height);
$background_color = imagecolorallocate ($im, 255, 255, 255); //white background
$text_color = imagecolorallocate ($im, 0, 0,0);//black text
imagestring ($im, $font, 0, 0, $string, $text_color);
imagepng ($im);
?>
I use something like this for spamprotection of my visitors (pass userid as an url-parameter for
this php)
--
http://www.php.net/manual/en/function.imagestring.php
http://master.php.net/manage/user-notes.php?action=edit+29485
http://master.php.net/manage/user-notes.php?action=delete+29485
http://master.php.net/manage/user-notes.php?action=reject+29485