1
function setImageSize()
{
$MaxCharWidth = 0;
$MaxCharHeight = 0;
$oImage = imagecreatetruecolor(100, 100);
$text_color = imagecolorallocate($oImage, mt_rand(0, 100), mt_rand(0, 100), mt_rand(0, 100));
$FontSize = $this->config["fontsize_max"];
for ($Angle = -30; $Angle <= 30; $Angle++) {
for ($i = 65; $i <= 90; $i++) {
$CharDetails = imageftbbox($FontSize, $Angle, $this->font, chr($i), array());
$_MaxCharWidth = abs($CharDetails[0] + $CharDetails[2]);
if (($_MaxCharWidth > $MaxCharWidth ) && ($_MaxCharWidth < 1000000)) {
$MaxCharWidth = $_MaxCharWidth;
}
$_MaxCharHeight = abs($CharDetails[1] + $CharDetails[5]);
if (($_MaxCharHeight > $MaxCharHeight ) && ($_MaxCharHeight < 1000000)) {
$MaxCharHeight = $_MaxCharHeight;
}
}
}
imagedestroy($oImage);
$this->height = $MaxCharHeight + 2;
$this->spacing = intval( ($this->config["num_chars"] * $MaxCharWidth) / $this->config["num_chars"] );
$this->width = ($this->config["num_chars"] * $MaxCharWidth) + ($this->spacing/2);
}
class/captcha/image/scripts/image.php line 202 and 206
of xoops 2,4,5
$_MaxCharWidth and $_MaxCharHeight get a high values (2147483651 p ex) only on first call of imageftbbox...
making a big loop on function drawBars(), server slow response and no shows the image...
i resolved adding && ($_MaxCharWidth < 1000000)
working fine now...