Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/04/2012, 06:29
sisko
 
Fecha de Ingreso: junio-2007
Mensajes: 46
Antigüedad: 16 años, 11 meses
Puntos: 0
CAPTCHA dificil de leer con libreria GD

Hola

Necesito un captcha para el sitio de un cliente. Googleando un poco encontre un script bastante simple y funciona bien.
El problema es que el texto generado usa un fuente comun y yo necesito algo mas dificil de leer. Busque en la documentacion de la libreri a GD pero no encontre nada relevante.
Alguien sabe como puedo darle efectos al texto generado para complicar su lectura?

Este es el codigo actual:

<?php
session_start();

$RandomStr = md5(microtime());// md5 to generate the random string

$ResultStr = substr($RandomStr,0,5);//trim 5 digit

$NewImage =imagecreatefromjpeg("captcha.jpg");//image create by existing image and as back ground

$TextColor = imagecolorallocate($NewImage, 78, 114, 193);//text color-white


imagestring($NewImage, 5, rand(3,68), rand(2,5), $ResultStr, $TextColor);// Draw a random string horizontally

$_SESSION['key'] = $ResultStr;// carry the data through session

header("Content-type: image/jpeg");// out out the image

imagejpeg($NewImage);//Output image to browser

?>

Muchas gracias!