Hi I had a captcha script in my web page. Some thing like this..

session_start();
$md5 = md5(microtime() * mktime());
$string = substr($md5,0,5);

$captcha = imagecreatefrompng("images/captcha.png");
$black = imagecolorallocate($captcha, 0, 0, 0);
$line = imagecolorallocate($captcha,233,239,239);
imageline($captcha,0,0,39,29,$line);
imageline($captcha,40,0,64,29,$line);

imagestring($captcha, 5, 20, 10, $string, $black);
$_SESSION['key'] = md5($string);

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

It works fine... But I need to add a custom font to the captcha text... Please help me what changes I need to make in this script..
Also Is it is easy to load a single word as captcha text from a .txt file which stored externally ??????

Please help me
Thanks in advance
Rajeesh

i m also looking for same

Hi finally I found the solution....
We can do it with the gdf font successfully not with the ttf fonts....
I found a software which convert ttf to gdf font ... The link

http://www.wedwick.com/wftopf.exe

And the code is like this

$captcha = imagecreatefrompng("images/captcha.png");
$black = imagecolorallocate($captcha, 0, 0, 0);
$captchaFont = imageloadfont('cc.gdf');
imagestring($captcha,$captchaFont, 20, 10, $rand, $black);

imagepng($captcha);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.