Changeset 3176139
- Timestamp:
- 10/26/2024 06:23:49 PM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ejabberd-account-tools/trunk/third-party/Captcha/CaptchaBuilder.php
r2346017 r3176139 141 141 $this->builder = $builder; 142 142 } 143 143 144 144 $this->phrase = is_string($phrase) ? $phrase : $this->builder->build($phrase); 145 145 } … … 342 342 343 343 // 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; 345 345 $box = \imagettfbbox($size, 0, $font, $phrase); 346 346 $textWidth = $box[2] - $box[0]; 347 347 $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; 350 350 351 351 if (!$this->textColor) { … … 428 428 $bg = imagecolorallocate($image, $color[0], $color[1], $color[2]); 429 429 } 430 $this->background = $bg;431 430 imagefill($image, 0, 0, $bg); 432 431 } else { … … 606 605 next($this->fingerprint); 607 606 } else { 608 $value = mt_rand( $min,$max);607 $value = mt_rand((int)$min, (int)$max); 609 608 $this->fingerprint[] = $value; 610 609 } … … 732 731 default: 733 732 throw new Exception('Not supported file type for background image!'); 734 break;735 733 } 736 734
Note: See TracChangeset
for help on using the changeset viewer.