Search code examples
codeignitercodeigniter-2codeigniter-3simplecaptcha

what is the image path and image url in this generate captcha function?


I'm trying to find img_path and img_url as given in below controller function. That is generateing captcha code. Does anybody know what is the img_path and img_url given in below controller function?

Controller

 function generateCaptcha() {

            //Load Captcha helper
            $this->load->helper('captcha');

                $vals = array(
                    'word'       => 'Security Key words',
                    'img_path'   => './uploads/captcha/',
                    'img_url'    => base_url() . 'captcha/',
                    'img_width'  => 200,
                    'img_height' => 50,
                    'expiration' => 7200,
                );

                /* Generate the captcha */
                $captcha = create_captcha($vals);

                /* Store the captcha value (or 'word') in a session to retrieve later */
                $this->session->set_userdata('captchaWord', $captcha['word']);
                $this->session->set_userdata('captchaImage', $captcha['image']);

                return $captcha['image'];
            }

Solution

  • Here

    img_path is the absolute path to your captach folder

    img_url is the relative path of the captach image

    $vals = array(
        'word'       => 'Security Key words',
        'img_path'   => './uploads/captcha/',
        'img_url'    => base_url() . 'uploads/captcha/',
        'img_width'  => 200,
        'img_height' => 50,
        'expiration' => 7200,
    );