如何增加codeigniter验证码助手的字体大小

时间:2022-01-23 20:16:58

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

我正在使用codeigniter * capctha * helper。事情是我不能增加字母的字体大小。我试着这样做

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.

但没有任何反应,如何更改字体大小,请帮忙。提前致谢。

2 个解决方案

#1


5  

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...).

仔细检查您正在使用的字体。有些字体有一种尺寸,就是这样。默认字体文件(texb.ttf)只有一个大小(?我想......)。

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.

选择一个字体文件并将其放在fonts文件夹中并尝试一下。

#2


0  

You may use "true type" fonts in captha's font_path to get a bigger size. Try to set path/to/your/ttfont.ttf in font_path and then pass a greater value to font_size. It should work!

你可以在captha的font_path中使用“true type”字体来获得更大的尺寸。尝试在font_path中设置path / to / your / ttfont.ttf,然后将更大的值传递给font_size。它应该工作!

#1


5  

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...).

仔细检查您正在使用的字体。有些字体有一种尺寸,就是这样。默认字体文件(texb.ttf)只有一个大小(?我想......)。

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.

选择一个字体文件并将其放在fonts文件夹中并尝试一下。

#2


0  

You may use "true type" fonts in captha's font_path to get a bigger size. Try to set path/to/your/ttfont.ttf in font_path and then pass a greater value to font_size. It should work!

你可以在captha的font_path中使用“true type”字体来获得更大的尺寸。尝试在font_path中设置path / to / your / ttfont.ttf,然后将更大的值传递给font_size。它应该工作!