CodeIgniter Forums

Full Version: how to specify img_url in captcha settings?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone I'm having hard time with Codeigniter captcha library. Browser in my web page do not show any captcha img file, i think it is problem with img_url option because img file location is 'http://localhost/blog/captcha/1455115990.3884.jpg' and when i try directly access it throw browser, i just get codeigniter default 404 window, but in my captcha directory in my web project root folder codeigniter successfully creating captcha img files. Any suggestions what i can do differently?

Controller 

Code:
function post($postID){
   $this->load->model('comment');
   $data['comments']=$this->comment->get_comments($postID);
   $this->load->helper('form');

   $this->load->helper('captcha');

   $vals=array(
       'img_path'=> './captcha/',
       'img_url'=>base_url().'captcha/',
       'img_width'=>150,
       'img_height'=>30
   );
   $cap = create_captcha($vals);
   $this->session->set_userdata('captcha', $cap['word']);
   $data['captcha']=$cap['image'];

   $data['post']=$this->Post->get_post($postID);
   $this->load->view('post', $data);
}
View

Code:
<p>Captcha Code: <?=$captcha ?> <br /><?php
                   $data_form=array(
                       'name'=>'captcha'
                   );
               echo form_input($data_form);
               ?>

           </p>
Can you post a path where image file is saved? Also, do you use any rewrite rules?