asmith Posted January 9, 2008 Share Posted January 9, 2008 making captcha image with php is so easy . you can set the text font, lines , color ... i see a captcha here : http://www.aoaforums.com/forum/register.php?do=register it is so colorful , background change every time. the thing i really really want to learn is : 1.how can i rotate "each" letter or number ? for example rotate 30` . or 45` . 2. how about the background image ? i use solid color for the captcha background, how do they use background image ? 3.seems they've give each letter or number one different color ? here's the some peice of code i usually use : <?php // create the image resource $image = ImageCreatetruecolor(150,150); // set colors $white = ImageColorAllocate($image, 255, 255, 255); $black = ImageColorAllocate($image, 0, 0, 0); // set background imagefill($image, 0, 0, $white); // set text imagettftext($image, 50, -10, 10, 45, $black, 'font.ttf', $the_code); // set lines imagesetthickness($image,2); imageline($image, 23, 2, 130, 2, $black); // created image imagejpeg($image); imagedestroy($image); ?> Link to comment https://forums.phpfreaks.com/topic/85142-solved-advance-captcha/ Share on other sites More sharing options...
aschk Posted January 9, 2008 Share Posted January 9, 2008 You can rotate an image using imagerotate(), however what I think you "might" need to do is, create an image for each letter, rotate each letter-image, and them merge all images onto a final image. Try that. I've never done this technique before (always just been satisfied with basic captcha + silly fonts) but there is no reason why it shouldn't work. Link to comment https://forums.phpfreaks.com/topic/85142-solved-advance-captcha/#findComment-434378 Share on other sites More sharing options...
asmith Posted January 9, 2008 Author Share Posted January 9, 2008 will be the size of the final imgae so high ? and how do i merge images together? Link to comment https://forums.phpfreaks.com/topic/85142-solved-advance-captcha/#findComment-434379 Share on other sites More sharing options...
aschk Posted January 9, 2008 Share Posted January 9, 2008 You create a truecolorimage (whatever height/width you want) and super impose the other images onto it using the imagecopyresized() function. See http://uk2.php.net/manual/en/function.imagecopyresized.php Link to comment https://forums.phpfreaks.com/topic/85142-solved-advance-captcha/#findComment-434384 Share on other sites More sharing options...
asmith Posted January 9, 2008 Author Share Posted January 9, 2008 thanks for the idea, i'll give it a try! you know how to set a background image for captcha image instead of a solid color ? Link to comment https://forums.phpfreaks.com/topic/85142-solved-advance-captcha/#findComment-434388 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.