Ver Mensaje Individual
  #5 (permalink)  
Antiguo 17/10/2010, 08:37
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: Hacer la letra más grande

cgm-util:

Utilizá imagettftext() en lugar de imagestring()
simplemente tenes que buscar una fuente TTF apropiada.
el tamaño se define en el 2º parámetro de imagettftext()

Código PHP:
Ver original
  1. <?php
  2. function randomText($length) {
  3.  
  4. $pattern = '1234567890abcdefghijklmnopqrstuwxyz';
  5. for($i=0;$i<$length;$i++) {
  6. $key .= $pattern{rand(0,35)};
  7. }
  8. return $key;
  9. }
  10. $fuente ="Swiss721CondensedBT.ttf";
  11.  
  12. $_SESSION['tmptxt'] = randomText(6);
  13. $captcha = imagecreatefromgif("bgcaptcha1.gif");
  14. $colText = imagecolorallocate($captcha, 0, 0, 0);
  15. //imagestring($captcha, 5, 10, 7, $_SESSION['tmptxt'], $colText);
  16. imagettftext($captcha, 25, 3, 20, 35,$colText, $fuente, $_SESSION['tmptxt']);
  17.  
  18. header("Content-type: image/gif");
  19. imagegif($captcha);
  20. ?>

Demo:
http://foros.emprear.com/php/captcha/cap2.php

Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.

Última edición por emprear; 17/10/2010 a las 08:38 Razón: url invalida