Plugin Directory

Changeset 3176139


Ignore:
Timestamp:
10/26/2024 06:23:49 PM (17 months ago)
Author:
Beherit
Message:

Update Gregwar Captcha

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ejabberd-account-tools/trunk/third-party/Captcha/CaptchaBuilder.php

    r2346017 r3176139  
    141141            $this->builder = $builder;
    142142        }
    143        
     143
    144144        $this->phrase = is_string($phrase) ? $phrase : $this->builder->build($phrase);
    145145    }
     
    342342
    343343        // Gets the text size and start position
    344         $size = $width / $length - $this->rand(0, 3) - 1;
     344        $size = (int) round($width / $length) - $this->rand(0, 3) - 1;
    345345        $box = \imagettfbbox($size, 0, $font, $phrase);
    346346        $textWidth = $box[2] - $box[0];
    347347        $textHeight = $box[1] - $box[7];
    348         $x = ($width - $textWidth) / 2;
    349         $y = ($height - $textHeight) / 2 + $size;
     348        $x = (int) round(($width - $textWidth) / 2);
     349        $y = (int) round(($height - $textHeight) / 2) + $size;
    350350
    351351        if (!$this->textColor) {
     
    428428                $bg = imagecolorallocate($image, $color[0], $color[1], $color[2]);
    429429            }
    430             $this->background = $bg;
    431430            imagefill($image, 0, 0, $bg);
    432431        } else {
     
    606605            next($this->fingerprint);
    607606        } else {
    608             $value = mt_rand($min, $max);
     607            $value = mt_rand((int)$min, (int)$max);
    609608            $this->fingerprint[] = $value;
    610609        }
     
    732731            default:
    733732                throw new Exception('Not supported file type for background image!');
    734                 break;
    735733        }
    736734
Note: See TracChangeset for help on using the changeset viewer.