Can some one let me know how I can use google web fonts for creating text captcha?
<?php
$img = imagecreatetruecolor(200, 200);
$bgColor = imagecolorallocate($img, 255, 255, 255);
$netColor = imagecolorallocate($img, 185, 185, 185);
$txtColor = imagecolorallocate($img, 0, 0, 0);
imagefill($img, 0, 0, $bgColor);
imagettftext($img, 22, 0, 50 ,45, $txtColor,"Bedizen.ttf","Expert" );
header("Content-type:image/png");
imagepng($img);
imagedestroy($img);
?>
As you can see from above code I am using a font file to render the text but is there any way to navigate to one of Google free web fonts? Thanks
For anyone that stumbles across this question (as I did) - this is do-able. As Marc commented, you need to download the font from Google Fonts, upload to your webserver and include it that way.
I needed to include the full path to the font eg:
imagettftext($img, 22, 0, 50 ,45, $txtColor,"/path/to/webroot/fonts/Downlo-Bold.ttf","Expert" );