Captcha using Codeigniter is not working
Please try in Controller:
$data['cap'] = create_captcha($vals);$this->load->view('captcha_view', $data);
And then in view:
echo form_input($cap);
UPDATE**
Also don't use base url, simply
'img_path' => 'img/photos/', 'img_url' => 'img/photos/', 'font_path' => 'system/fonts/texb.ttf',
Controller: Captcha.php
class Captcha extends CI_Controller {
public function captcha_example(){ $this->load->helper("captcha"); $this->load->helper('form'); $vals = array( 'word' => 'Random word', 'img_path' => base_url().'img/photos/', 'img_url' => base_url().'img/photos/', 'font_path' => base_url().'system/fonts/texb.ttf', 'img_width' => 150, 'img_height' => 30, 'expiration' => 7200, ); $data['cap'] = create_captcha($vals); $this->load->view('captcha_view', $data); //echo $vals['img_url'];}
}
View: captcha.php
echo form_input($cap);