Problem displaying captcha code Problem displaying captcha code
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Problem displaying captcha code

Started by forumac, June 28, 2022, 09:18:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

forumac

When adding comments the captcha code displays only lines, no letters.
https://www.forumancientcoins.com/ancient-maps/displayimage.php?album=34&pid=366#top_display_media
We are using CPG 1.6.03, the problem happend when upgrading to PHP 7.2.
The same php.ini file is used and of course GD2 is enabled ("extension=php_gd2.dll").
Here is how captcha.php displays: https://www.forumancientcoins.com/Ancient-Maps/captcha.php
And here is DrawCharacters() function from captcha.inc.php
      function DrawCharacters() {
         // loop through and write out selected number of characters
         for ($i = 0; $i < strlen($this->sCode); $i++) {
            // select random font
            $sCurrentFont = $this->aFonts[array_rand($this->aFonts)];

            // select random greyscale colour
            $iRandColour = rand(0, 100);
            $iTextColour = imagecolorallocate($this->oImage, $iRandColour, $iRandColour, $iRandColour);

            if ($this->bCharShadow) {
               // shadow colour
               $iRandColour = rand(0, 100);
               $iShadowColour = imagecolorallocate($this->oImage, $iRandColour, $iRandColour, $iRandColour);
            }

            // select random font size
            $iFontSize = rand(16, 25);

            // select random angle
            $iAngle = rand(-30, 30);

            // get dimensions of character in selected font and text size
            $aCharDetails = imageftbbox($iFontSize, $iAngle, $sCurrentFont, $this->sCode[$i]);

            // calculate character starting coordinates
            $iX = $this->iSpacing / 4 + $i * $this->iSpacing;
            $iCharHeight = $aCharDetails[2] - $aCharDetails[5];
            $iY = $this->iHeight / 2 + $iCharHeight / 4;

            // write text to image
            imagefttext($this->oImage, $iFontSize, $iAngle, $iX, $iY, $iTextColour, $sCurrentFont, $this->sCode[$i]);

            if ($this->bCharShadow) {
               $iOffsetAngle = rand(-30, 30);

               $iRandOffsetX = rand(-5, 5);
               $iRandOffsetY = rand(-5, 5);

               imagefttext($this->oImage, $iFontSize, $iOffsetAngle, $iX + $iRandOffsetX, $iY + $iRandOffsetY, $iShadowColour, $sCurrentFont, $this->sCode[$i]);
            }
         }
      }


forumac

Sorry, for the first link you must be logged in, I'm sending here a screen capture:

forumac

And the upgrade was from PHP 7.1 to PHP 7.2, nothing changed to CPG, it is still version 1.6.03.

phill104

Please upgrade to the latest release. If the problem still exists we can help then
It is a mistake to think you can solve any major problems just with potatoes.