note 33084 deleted from function.imagestring by aidan

From: Date: Thu, 26 Aug 2004 06:26:50 +0000
Subject: note 33084 deleted from function.imagestring by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75282@lists.php.net to get a copy of this message
Note Submitter: php at ukchatterbox dot com ---- <?php /* Creates a Random word image, to prevent automatic signup If you provide $hash (int) through get or POST it will use that word in the array $wordlist otherwise it will make a random image. Automatically creates some background circles which will be randomised to a lighter colour than the text $circle is the number of background circles Hope you find this useful */ $wordlist=array("butter","clock","wood","mouse","medel","cup","bread", "crisps","towel","chair", "bottle","can", "potatoe","brush","hat", "carpet","wires","music","humans","dog","cat"); $circles=5; $width=100; $height=40; $font=3; $randno=rand(0,sizeof($wordlist)-1); if (!$hash) { $string=$wordlist[$randno]; } else { $string=$wordlist[$hash]; } $fontwidth = ImageFontWidth($font) * strlen($string); $fontheight = ImageFontHeight($font); $im = @imagecreate ($width,$height); $background_color = imagecolorallocate ($im, 255, 255, 255); $text_color = imagecolorallocate ($im, rand(0,100), rand(0,100), rand(0,100)); // Random Text for ($i=1;$i<=$circles;$i++) { $randomcolor = imagecolorallocate ($im , rand(100,255), rand(100,255),rand(100,255)); imagefilledellipse($im,rand(0,$width-10),rand(0,$height-3), rand(20,70),rand(20,70),$randomcolor); } imagerectangle($im,0,0,$width-1,$height-1,$text_color); imagestring ($im, $font, rand(3, $width-$fontwidth-3), rand(2,$height-$fontheight-3), $string, $text_color); header ("Content-type: image/jpeg"); imagejpeg ($im,'',80); ?>

« previous php.notes (#75282) next »