Welcome Guest, Not a member yet? Register   Sign In
how to custome width and height captcha
#1

[eluser]Tống Kiện Phi[/eluser]
This is my function create captcha:
Code:
function captcha($config = array())
  {
      $conf = array(
        ‘width’ => 70,
        ‘height’ => 28
      );
      
      $conf = array_merge($conf, $config);
      
      $CI = & get_instance();
      $CI->load->helper(‘captcha’);
      $vals = array(
        ‘word’      => mt_rand(1000,9999),
        ‘img_path’    => ‘public/captcha/’,
        ‘img_url’    => $CI->config->item(‘base_url’) . ‘public/captcha/’,
        ‘expiration’  => 2,
        ‘img_width’    => $conf[‘width’],
        ‘img_height’  => $conf[‘height’]
      );
      $cap = create_captcha($vals);
      $CI->session->set_userdata(‘security_code’,$cap[‘word’]);
      return $cap;
  }
it’s display ok but some characters lost in image (Captcha1.PNG)
F5 many times it’s must display ok (Captcha2.PNG)
#2

[eluser]InsiteFX[/eluser]
If the images are a different size then you would need to use the image lib and resize them.





Theme © iAndrew 2016 - Forum software by © MyBB