Skip to content

Commit

Permalink
Improvements to secuirty image
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/phpsurveyor@2478 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
David Olivier committed Mar 1, 2007
1 parent de9c3a1 commit 2ffef7d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
Binary file added fonts/vera.ttf
Binary file not shown.
Binary file added fonts/verait.ttf
Binary file not shown.
30 changes: 28 additions & 2 deletions images/verification.php
Expand Up @@ -10,6 +10,9 @@
$im = ImageCreate(75, 20);
$white = ImageColorAllocate($im, 255, 255, 255);
$black = ImageColorAllocate($im, 0, 0, 0);
$red = ImageColorAllocate($im, 255, 0, 0);
$blue = ImageColorAllocate($im, 0, 0, 255);
$grey_shade = ImageColorAllocate($im, 204, 204, 204);

// Create the random numberes
srand((double)microtime()*1000000);
Expand All @@ -25,12 +28,35 @@
break;
}
}
$font_c_rand = rand(1,3);
if ($font_c_rand == 1)
{
$font_color = $black;
} else if ($font_c_rand == 2)
{
$font_color = $red;
} else if ($font_c_rand == 3)
{
$font_color = $blue;
}

$font_rand = rand(1,3);
if ($font_rand == 1)
{
$font = "../fonts/verabd.ttf";
} else if ($font_rand == 2) {
$font = "../fonts/vera.ttf";
} else if ($font_rand == 3)
{
$font = "../fonts/verait.ttf";
}


// Fill image, make transparent
ImageFill($im, 0, 0, $white);
ImageFill($im, 0, 0, $grey_shade);
imagecolortransparent ($im, $white);
// Write math question in a nice TTF Font
ImageTTFText($im, 10, 0, 2, 16,$black, "../fonts/verabd.ttf", $num1." + ".$num2." =" );
ImageTTFText($im, 10, 0, 2, 16,$font_color, $font, $num1." + ".$num2." =" );

// Display Image
ImagePNG($im);
Expand Down

0 comments on commit 2ffef7d

Please sign in to comment.