Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Captcha
john_doe
post 30.04.2010, 21:43:11
Post #1





Grupa: Zarejestrowani
Postów: 873
Pomógł: 25
Dołączył: 24.07.2005

Ostrzeżenie: (0%)
-----


Witam, zrobiłem sobie captche
  1. function _generateRandomString($length=6)
  2. {
  3. $_rand_src = array(
  4. array(48,57)
  5. , array(97,122)
  6. // , array(65,90)
  7. );
  8. srand ((double) microtime() * 1000000);
  9. $random_string = "";
  10. for( $i = 0 ; $i < $length ; $i++)
  11. {
  12. $i1 = rand(0,sizeof($_rand_src)-1);
  13. $random_string .= chr(rand($_rand_src[$i1][0],$_rand_src[$i1][1]));
  14. }
  15. return $random_string;
  16. }
  17.  
  18. $im = @imagecreatefromjpeg("captcha.jpg");
  19.  
  20. $rand = _generateRandomString(3);
  21.  
  22. $_SESSION['captcha'] = $rand;
  23.  
  24. ImageString($im, 5, 2, 2, $rand[0]." ".$rand[1]." ".$rand[2]." ", ImageColorAllocate ($im, 0, 0, 0));
  25.  
  26. $rand = _generateRandomString(3);
  27.  
  28. ImageString($im, 5, 2, 2, " ".$rand[0]." ".$rand[1]." ".$rand[2], ImageColorAllocate ($im, 255, 0, 0));
  29.  
  30. Header ('Content-type: image/jpeg');
  31.  
  32. imagejpeg( $im, NULL, 100 );
  33.  
  34. ImageDestroy($im);


nie potrafię zwiększyć czcionki. Wg dokumentacji funkcja imageString i jej drugi parametr.
Co robię nie tak??
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 18.07.2025 - 02:08