asmith Posted November 20, 2007 Share Posted November 20, 2007 i finally created a captcha image with this file : <? session_start(); header("Content-Type: image/jpeg"); // *** Send a generated image to the browser *** die(create_image()); // *** Function List *** function create_image() { // *** Generate a passcode using md5 // (it will be all lowercase hex letters and numbers *** $md5 = md5(rand(0,9999)); $pass = substr($md5, 10, 5); // *** Set the session cookie so we know what the passcode is *** $_SESSION["pass"] = $pass; // *** Create the image resource *** $image = ImageCreatetruecolor(100, 70); // *** We are making two colors, white and black *** $clr_white = ImageColorAllocate($image, 255, 255, 255); $clr_black = ImageColorAllocate($image, 0, 0, 0); // *** Make the background black *** imagefill($image, 0, 0, $clr_black); // *** Set the image height and width *** imagefontheight(150); imagefontwidth(150); // *** Add the passcode in white to the image *** imagestring($image, 5, 30, 3, $pass, $clr_white); // *** Throw in some lines to trick those cheeky bots! *** imageline($image, 5, 1, 50, 20, $clr_white); imageline($image, 60, 1, 96, 20, $clr_white); // *** Return the newly created image in jpeg format *** return imagejpeg($image); // *** Just in case... *** imagedestroy($image); } ?> i can't find font size finction ?? and i've changed this line values but nothing changes here, what this is for ? // *** Set the image height and width *** imagefontheight(150); imagefontwidth(150); Quote Link to comment Share on other sites More sharing options...
asmith Posted November 20, 2007 Author Share Posted November 20, 2007 no one knows how can i make the font bigger? Quote Link to comment Share on other sites More sharing options...
pranav_kavi Posted November 20, 2007 Share Posted November 20, 2007 ve u tried using imagettfbbox fn??? Quote Link to comment Share on other sites More sharing options...
asmith Posted November 20, 2007 Author Share Posted November 20, 2007 is there any line i could use without inserting any font? just want to make its own font bigger Quote Link to comment Share on other sites More sharing options...
pranav_kavi Posted November 20, 2007 Share Posted November 20, 2007 u can work on the font size of the string by referring to the documentation for imagestring at http://www.php.net/manual/en/function.imagestring.php. // *** Add the passcode in white to the image *** imagestring($image, 5, 30, 3, $pass, $clr_white); Quote Link to comment Share on other sites More sharing options...
asmith Posted November 20, 2007 Author Share Posted November 20, 2007 yea ! worked ! thanks ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.