<?php

session_start();


$num1=rand(1,9); //Generate First number between 1 and 9  
$num2=rand(1,9); //Generate Second number between 1 and 9  
$captcha_total=$num1+$num2;  

 
$math = "$num1"." + "."$num2"."=";  
$_SESSION['rand_code'] = $captcha_total;

$dir = 'fonts/';

$image = imagecreatetruecolor(120, 25); //Change the numbers to adjust the size of the image
$black = imagecolorallocate($image, 0, 0, 0);
$color = imagecolorallocate($image, 208, 47, 47);
$white = imagecolorallocate($image, 222, 236, 245);


imagefilledrectangle($image,0,0,500,250,$white);
imagettftext ($image, 15, 0, 15, 20, $color, $dir."georgia.ttf", $math );//Change the numbers to adjust the font-size


header("Content-type: image/png");
imagepng($image);

?>