tags:

views:

1169

answers:

3

I have the following block of code which will output a captcha image

 $im = @imagecreatefromjpeg("captcha.jpg"); 
 $rand = _generateRandom(3);
 $_SESSION['captcha'] = $rand;
 ImageString($im, 5, 2, 2, $rand[0]." ".$rand[1]." ".$rand[2]." ", ImageColorAllocate ($im, 23, 85, 160));

Now i want to increaese the font size.I have used the second paramater as 5 .I know that we can use from 1 to 5 only.But i want to increaese the \font size a bit more.Also i want to change the font also to some other like Arial or Verdana.How to do that ? Thanks in advance

+1  A: 

It sounds like you'd be better off using imagettftext:

array imagettftext ( resource $image , float $size , float $angle , int $x , int $y , int $color , string $fontfile , string $text )
Greg
A: 

Use the imagettftext() function.

$im = @imagecreatefromjpeg("captcha.jpg"); 
 $rand = _generateRandom(3);
 $_SESSION['captcha'] = $rand;
 ImageString($im, $size, 0, 2, 2, ImageColorAllocate ($im, 23, 85, 160), $fontfile, $rand[0]." ".$rand[1]." ".$rand[2]." ");

where $size is the font size, and $fontfile is a file containing a TTF font. For more usage information, see the PHP manual entry (linked above).

Zarel
A: 

how to font size increase using gd in php