CodeIgniter Forums
captcha image not loading in server - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: captcha image not loading in server (/thread-71158.html)



captcha image not loading in server - kvanaraj - 07-13-2018

captcha image not loading in server
******************************
view file
********
<div id="imgdiv" style="display: inline;"><img id="img" src="<?= base_url() ?>login/getcapachaimage" /></div><img id="reload" src="<?= base_url() ?>img/reload.png" />


RE: captcha image not loading in server - ciadmin - 07-13-2018

Help us help you ... what error message or unexpected behavior are you getting?
Do your files exist? You are requesting the images "BASE_URL/login/getcapachaiumage", which sounds like a controller referencem=, and BASE_URL/img/reload.png. Is the second one showing up?


RE: captcha image not loading in server - Pertti - 07-13-2018

Assuming you are using CodeIgniter Catpcha helper.

You have to use generated image URL instead of hardcoded URL.

Controller:
PHP Code:
$cap create_captcha($captcha_options);
$this->load->view('yourview', ['cap' => $cap]); 

View:
Code:
<?= $cap['image'] ?>

The image attribute already holds full img tag.

More in the manual:
https://www.codeigniter.com/user_guide/helpers/captcha_helper.html


RE: captcha image not loading in server - kvanaraj - 07-13-2018

(07-13-2018, 08:10 AM)Pertti Wrote: Assuming you are using CodeIgniter Catpcha helper.

You have to use generated image URL instead of hardcoded URL.

Controller:
PHP Code:
$cap create_captcha($captcha_options);
$this->load->view('yourview', ['cap' => $cap]); 

View:
Code:
<?= $cap['image'] ?>

The image attribute already holds full img tag.

More in the manual:
https://www.codeigniter.com/user_guide/helpers/captcha_helper.html
I try with this solution,but not get it
I attached both file also please make a correction