Captcha image src issue |
Hi I am trying to use CI's captcha . All though my captcha is getting created , the src of the captcha img that CI is generating is not correct .
I have an User controller with register function like below : (Complete Controller is at pastebin https://pastebin.com/pSskpuy0) PHP Code: public function register(){ 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 . I my view I have : PHP Code: <div class="form-group"> The problem is my image is not showing up . When inspected the captcha image I found it to be correct like below : Code: <img id="Imageid" src="./captcha/1551023447.5228.jpg" style="width: 150; height: 30; border: 0;" alt=" "> However , the src is actually getting 'computed' to : /login/user/captcha/1551023447.5228.jpg]http://[::1]/login/user/captcha/1551023447.5228.jpg instead of /login/captcha/1551023447.5228.jpg]http://[::1]/login/user/captcha/1551023447.5228.jpg . ![]() Could somebody tell me why the src is pointing to /login/user/captcha/1551023447.5228.jpg]http://[::1]/login/user/captcha/1551023447.5228.jpg all though it should be /login/captcha/1551023447.5228.jpg]http://[::1]/login/captcha/1551023447.5228.jpg and how we can fix this ? Surprisingly the same code is running all right in another project with same directory structure .
You told it where to point. Your URI is "/login/user/register, so the browser thinks you are in the "/login/user" folder, and the reference "/login/user/captcha..." is correct from its perspective.
If you actually meant to refer to something in your document root, then the reference should be "/captcha/...", without the leading "." ![]() |
Welcome Guest, Not a member yet? Register Sign In |