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)


Messages In This Thread
how to custome width and height captcha - by El Forum - 05-13-2014, 02:53 AM
how to custome width and height captcha - by El Forum - 05-16-2014, 05:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB