note 68296 added to ref.image
| From: | sampathperera at hotmail dot com-SriLanka | Date: | Fri, 21 Jul 2006 05:04:49 +0000 |
| Subject: | note 68296 added to ref.image | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-114997@lists.php.net to get a copy of this message | ||
I have used following function to generate Security Images to authenticate users are real humans.
Need to have GD graphic library with FreeType enabled.
Used a gif file as background, put random text on it & creates a new gif file as output.
<?php
function createImage(){
// creates the images, writes the file
$fileRand = md5(rand(100000,999999));
$string_a =
array("A","B","C","D","E","F","G","H","J","K",
"L","M","N","P","R","S","T","U","V","W","X","Y","Z",
"2","3","4","5","6","7","8","9");
$keys = array_rand($string_a, 6);
foreach($keys as $n=>$v){
$string .= $string_a[$v];
}
$backgroundimage = "security_background.gif";
$im=imagecreatefromgif($backgroundimage);
$colour = imagecolorallocate($im, rand(0,255), rand(0,255), rand(0,255));
$font = 'Arial';
$angle = rand(-5,5);
// Add the text
imagettftext($im, 16, $angle, 15, 25, $colour, $font, $string);
$outfile= "$fileRand.gif";
imagegif($im,$outfile);
return $outfile;
}
echo "<IMG SRC=".createImage()." name=secimg>";
?>
----
Server IP: 66.163.161.117
Probable Submitter: 220.247.225.253
----
X-Spam-Status: No, hits=3.8 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER,
HTML_IMAGE_ONLY_08,HTML_MESSAGE autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/ref.image.php
Edit -- http://master.php.net/note/edit/68296
Del: integrated -- http://master.php.net/note/delete/68296/integrated
Del: useless -- http://master.php.net/note/delete/68296/useless
Del: bad code -- http://master.php.net/note/delete/68296/bad+code
Del: spam -- http://master.php.net/note/delete/68296/spam
Del: non-english -- http://master.php.net/note/delete/68296/non-english
Del: in docs -- http://master.php.net/note/delete/68296/in+docs
Del: other reasons-- http://master.php.net/note/delete/68296
Reject -- http://master.php.net/note/reject/68296
Search -- http://master.php.net/manage/user-notes.php