无法更改 PHP 中验证码的大小

发布于 2024-08-18 06:30:55 字数 186 浏览 3 评论 0原文

我有以下验证码插件。

我尝试更改不同的字体大小,但没有一个起作用。

谁能告诉我如何更改字体大小。

提前致谢。

已编辑:此处代码

I have the following captcha plug-in.

I tried changing different font-size but none of them worked.

Could anyone tell me how to change the font-size please.

Thanks in advance.

EDITED: Code Here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

浸婚纱 2024-08-25 06:30:55

这个验证码是垃圾,而且这段代码写得不好。你应该使用 reCapthca,它非常好而且免费。

我有权说这个 capthca 是垃圾,因为我破坏了 capthcas:
http://web.nvd.nist.gov/查看/漏洞/详细信息?vulnId=CVE-2008-2019
http://web.nvd.nist.gov/查看/漏洞/详细信息?vulnId=CVE-2008-3573
http://web.nvd.nist.gov/查看/漏洞/详细信息?vulnId=CVE-2008-2020
http://web.nvd.nist.gov/查看/漏洞/详细信息?vulnId=CVE-2008-3573
(或者至少在 2008 年我做到了:)

但要真正回答你的问题:在第 127 行,正在生成挑战的长度。将数字 6 更改为您想要的任何数字。

    for ($i = 0; $i < 6; $i++)
    {
        $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1);
    }

This captcha is garbage and this code is poorly written. You should use reCapthca, it is very good and its free.

I have the right to say that that this capthca is garbage because I break capthcas:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-2019
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-3573
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-2020
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-3573
(Or atleast in 2008 I did :)

But to actually answer your question: On line 127 the length of the challenge is being generated. Change the number 6 to whatever you want.

    for ($i = 0; $i < 6; $i++)
    {
        $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1);
    }
梦屿孤独相伴 2024-08-25 06:30:55

更改这段代码中的字体大小,并为调用 mt_rand 输入更高的值。

if ($use_font == FALSE)
{
    //$font_size = 5;
    $font_size = 15;//For example
    $x = rand(2, $img_width/($length/3));
    // y isnt used here
}
else
{
    // Make font proportional to the image size
   // $font_size  = !empty($font_size) ? $font_size : mt_rand(18,25);
      $font_size  = !empty($font_size) ? $font_size : mt_rand(25,29);//For example
    $x = rand(4, $img_width - (($font_size + ($font_size >> 1)) * $length));
    // y isnt used here
}

另请确保 $img_width$img_height 足够大,以便较大的字体适合图像。

Change the font size in this piece of code, and enter higher values for the call to mt_rand.

if ($use_font == FALSE)
{
    //$font_size = 5;
    $font_size = 15;//For example
    $x = rand(2, $img_width/($length/3));
    // y isnt used here
}
else
{
    // Make font proportional to the image size
   // $font_size  = !empty($font_size) ? $font_size : mt_rand(18,25);
      $font_size  = !empty($font_size) ? $font_size : mt_rand(25,29);//For example
    $x = rand(4, $img_width - (($font_size + ($font_size >> 1)) * $length));
    // y isnt used here
}

Also make sure the $img_width and the $img_height are big enough so larger fonts will fit in the image.

有深☉意 2024-08-25 06:30:55

您可能想尝试在下面编写:

$defaults = array('word' => '', 'img_path' => '', 'img_url' => '', 'img_width' => '150', 'img_height' => '30', 'font_size' => '', 'font_path' => '', 'show_grid' => true, 'skew' => true, 'expiration' => 7200);

以下行

$defaults['font_size'] = 0;

(当然,请将 0 更改为您想要的大小)

You may want to try to write under that:

$defaults = array('word' => '', 'img_path' => '', 'img_url' => '', 'img_width' => '150', 'img_height' => '30', 'font_size' => '', 'font_path' => '', 'show_grid' => true, 'skew' => true, 'expiration' => 7200);

the following line

$defaults['font_size'] = 0;

(and change the 0 to your desired size of course)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文