CodeIgniter Forums
Creating captcha in form - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Creating captcha in form (/showthread.php?tid=51497)



Creating captcha in form - El Forum - 05-07-2012

[eluser]Musaddiq Khan[/eluser]
I want to include CI captcha in form.

I have used the following code.
Code:
$this->load->helper('captcha');
vals = array(
    'img_path'  => '<img src="http://phphost/furniture/static/captch/button.jpg" alt="" />' ,
    'img_url'  => 'http://phphost/furniture/static/captcha/'
    );

$cap = create_captcha($vals);
echo $cap['image'].'Hello....';

But it display nothing.


Creating captcha in form - El Forum - 05-07-2012

[eluser]vrencianz[/eluser]
<b>img_path</b> must be 'furniture/static/captcha/' and make sure that that directory exists and it is writeable by codeigniter.


Creating captcha in form - El Forum - 05-07-2012

[eluser]Musaddiq Khan[/eluser]
I have tried as described above, but no result
even nothing is in $cap array.


Creating captcha in form - El Forum - 05-07-2012

[eluser]InsiteFX[/eluser]
Code:
$this->load->helper('captcha');
vals = array(
    'img_path'  => './furniture/static/captch/',
    'img_url'  => 'http://phphost/furniture/static/captcha/'
    );

$cap = create_captcha($vals);
echo $cap['image'].'Hello....';



Creating captcha in form - El Forum - 05-08-2012

[eluser]Musaddiq Khan[/eluser]
I can't understand that what's wrong with my code, Still $cap is null.
But thanks to all.


Creating captcha in form - El Forum - 05-08-2012

[eluser]InsiteFX[/eluser]
Even I missed this at first look! But I am AWAKE now!
Code:
$this->load->helper('captcha');

// whats wrong with the line below? Missing $
vals = array(

// should be:
$vals = array(
    'img_path' => './furniture/static/captch/',
    'img_url'  => 'http://phphost/furniture/static/captcha/'
    );

$cap = create_captcha($vals);
echo $cap['image'].'Hello....';