[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)