Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i increase the font size of codeigniter captcha helper

I am using the codeigniter *capctha* helper. The thing is I can not increase the font size of letters. I tried to do it by

if ($use_font == FALSE)
{
    $font_size = 6;
    $x = rand(0, $img_width/($length/2));
    $y = 0;
}
else
{
    $font_size = 20;
    $x = rand(0, $img_width/($length/1.5));
    $y = $font_size+2;
}

but nothing happens, how can change the font size, please help. Thanks in advance.

like image 385
Kanishka Panamaldeniya Avatar asked Mar 13 '13 15:03

Kanishka Panamaldeniya


1 Answers

You are changing the correct parameter, whether in the core file or the application/helpers file.

Double check the font that you are using. Some fonts have one size and that is it. The default font file (texb.ttf) has only one size (? I think...).

I am using the following configuration:

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

$captchaSetup = array(
    'img_path'   => './captcha/',
    'img_url'    => base_url()."captcha/",
    'font_path'  => './assets/fonts/E004007T.TTF',
    'img_width'  => 250,
    'img_height' => 50,
    'expiration' => 7200
);

$capData['cap'] = create_captcha($captchaSetup);

Pick a font file and place it in the fonts folder and try it out.

like image 163
Marc Audet Avatar answered Nov 03 '22 23:11

Marc Audet