title: Codeigniter incorrect CAPTCHA image src
body: <p>Hi I am trying to use the CodeIgniter captcha helper for my registration page .
  I have an User controller with register function like below :</p>
  
  <pre><code>public function register(){   
      $this-&gt;form_validation-&gt;set_rules('user_name' , 'Username' , 'trim|required|max_length[32]'); 
      $this-&gt;form_validation-&gt;set_rules('captcha' , 'Captcha' , 'trim|required|max_length[32]|callback_check_captcha');
      $this-&gt;form_validation-&gt;set_rules('password', 'Password','trim|required|min_length[5]|max_length[12]');
      $this-&gt;form_validation-&gt;set_rules('confirm_password', 'Confirm Password','trim|required|min_length[5]|max_length[12]|matches[password]');
      $this-&gt;form_validation-&gt;set_rules('email', 'Email', 'trim|required|valid_email');
      if ($this-&gt;form_validation-&gt;run()==FALSE){
      //Captcha code 
      $this-&gt;load-&gt;helper('captcha');
      //Captcha Config 
      $vals = array(
          'img_path'      =&gt; './captcha/',
          'img_url'       =&gt; './captcha/',
          'img_width'     =&gt; '150',
          'img_height'    =&gt; 30,
          'expiration'    =&gt; 7200,
          'word_length'   =&gt; 8,
          'font_size'     =&gt; 16,
          'img_id'        =&gt; 'Imageid',
           'font_path'     =&gt; '/fonts/Open.ttf',
  
          // White background and border, black text and red grid
          'colors'        =&gt; array(
                  'background' =&gt; array(255, 255, 255),
                  'border' =&gt; array(255, 255, 255),
                  'text' =&gt; array(0, 0, 0),
                  'grid' =&gt; array(255, 40, 40)
          )
      );
      //Create the Captcha
      $cap = create_captcha($vals);
  
      // Store The Created Captcha in DB for Verification  
      $data = array(
      'captcha_time'  =&gt; $cap['time'],
      'ip_address'    =&gt; $this-&gt;input-&gt;ip_address(),
      'word'          =&gt; $cap['word']
      );
      $this-&gt;register_model-&gt;store_captcha($data);
      //Load View
      $data['image']=$cap['image'];
      var_dump($data['image']);exit();
      $this-&gt;load-&gt;view('templates/header');
      $this-&gt;load-&gt;view('register' , $data);
      $this-&gt;load-&gt;view('templates/footer');
      }else {
                $option=array('cost'=&gt;12);
                $encrypt_password=password_hash($this-&gt;input-&gt;post('password'),PASSWORD_BCRYPT,$option);
                $this-&gt;register_model-&gt;add_user($encrypt_password);
                $this-&gt;session-&gt;set_flashdata('user_registered','You are Successfully Registered and can Log in ');
                redirect('register/success');
      }
  }
  </code></pre>
  
  <p>If you see the above code I am setting the 'img_path' to './captcha/'(using the root relative method) . I have this folder captcha in the root .</p>
  
  <p>In my view I have  :</p>
  
  <pre><code>    &lt;div class="form-group"&gt;
      &lt;label&gt;Enter UserID&lt;/label&gt;
      &lt;input type="text" class="form-control" name="user_name"  placeholder="Enter Your UserId"&gt;
    &lt;/div&gt;
    &lt;div class="form-group"&gt;
      &lt;label&gt;Enter Your Email&lt;/label&gt;
      &lt;input type="email" class="form-control" name="email"  placeholder="Enter Your Email"&gt;
    &lt;/div&gt;
    &lt;div class="form-group"&gt;
      &lt;label&gt;Enter Your Password &lt;/label&gt;
      &lt;input type="password" class="form-control" name="password"  placeholder="Enter Password"&gt;
    &lt;/div&gt;
    &lt;div class="form-group"&gt;
          &lt;label&gt;Re-enter Password &lt;/label&gt;
          &lt;input type="password" class="form-control" name="confirm_password"  placeholder="Renter Password"&gt;
    &lt;/div&gt;
    &lt;?php echo $image ; ?&gt;
    &lt;div class="form-group"&gt;
          &lt;label&gt;Solve Captcha &lt;/label&gt;
          &lt;input type="text" class="form-control" name="captcha" &gt;
    &lt;/div&gt;
     &lt;button type="submit" class="btn btn-primary"&gt;Submit&lt;/button&gt;
    &lt;?php echo form_close();?&gt;
  </code></pre>
  
  <p></p>
  
  <p>The problem is my image is not showing up . When inspected the captcha image  I  found it to be correct like below : </p>
  
  <pre><code>&lt;img id="Imageid" src="./captcha/1551023447.5228.jpg" style="width: 150; height: 30; border: 0;" alt=" "&gt;
  </code></pre>
  
  <p>However , the src is actually getting 'computed' to : <a href="http://[::1]/login/user/captcha/1551023447.5228.jpg" rel="nofollow noreferrer">http://[::1]/login/user/captcha/1551023447.5228.jpg</a> . See the image below . </p>
  
  <p><a href="https://i.stack.imgur.com/FV0ce.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FV0ce.png" alt="computed src"></a></p>
  
  <p>Could somebody tell me why the src is pointing to <a href="http://[::1]/login/user/captcha/1551023447.5228.jpg" rel="nofollow noreferrer">http://[::1]/login/user/captcha/1551023447.5228.jpg</a>  all though  it should be <a href="http://[::1]/login/captcha/1551023447.5228.jpg" rel="nofollow noreferrer">http://[::1]/login/captcha/1551023447.5228.jpg</a>   ? I am also curious to know how hovering over the  img src in chrome shows a different value than what is actually in the code . I understand /.path is used to traverse folders from the root but this is the first time I am seeing something like this in chrome . Thanks . </p>