Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/11/2012, 17:09
pithon
 
Fecha de Ingreso: mayo-2011
Mensajes: 1.201
Antigüedad: 13 años
Puntos: 10
error al crear una imagen para captcha

probando un codigo para crear una imagen para captcha funciona correctamente en modo local osea en mi pc usando windows per si la subo a un servidor linux ya no me funciona me da el siguiente error.

cannot be displayed because it contains errors

este es el codigo:
Código PHP:
Ver original
  1. $captchaTextSize = 7;
  2. do {
  3.    $md5Hash = md5( microtime( ) * mktime( ) );
  4.    preg_replace( '([1aeilou0])', "", $md5Hash );
  5. }
  6. while( strlen( $md5Hash ) < $captchaTextSize );
  7.    $key = substr( $md5Hash, 0, $captchaTextSize );
  8.    $_SESSION['key'] = md5( $key );
  9.    $captchaImage = imagecreatefrompng( "imagenes/captcha.png" );
  10.    $textColor = imagecolorallocate( $captchaImage, 50, 105, 82 );
  11.    $lineColor = imagecolorallocate( $captchaImage, 15, 103, 103 );
  12.    $imageInfo = getimagesize( "imagenes/captcha.png" );
  13.    $linesToDraw = 10;
  14. for( $i = 0; $i < $linesToDraw; $i++ )  {
  15.     $xStart = mt_rand( 0, $imageInfo[ 0 ] );
  16.     $xEnd = mt_rand( 0, $imageInfo[ 0 ] );
  17.     imageline( $captchaImage, $xStart, 0, $xEnd, $imageInfo[1], $lineColor );
  18. }
  19. imagettftext( $captchaImage, 20, 0, 35, 35, $textColor, "fuente/VeraBd.ttf", $key );
  20. imagepng( $captchaImage );
No se si esque tengo que activar alguna extension php o modificar algo en php.ini, si alguien me puede ayudar gracias de antemano.
Saludos.