Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Problem displaying captcha code  (Read 1876 times)

0 Members and 1 Guest are viewing this topic.

forumac

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Problem displaying captcha code
« on: June 28, 2022, 09:18:38 pm »

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
Code: [Select]
      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]);
            }
         }
      }
Logged

forumac

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Problem displaying captcha code
« Reply #1 on: June 28, 2022, 09:42:52 pm »

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

forumac

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Problem displaying captcha code
« Reply #2 on: June 28, 2022, 09:45:53 pm »

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

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: Problem displaying captcha code
« Reply #3 on: June 29, 2022, 07:20:51 pm »

Please upgrade to the latest release. If the problem still exists we can help then
Logged
It is a mistake to think you can solve any major problems just with potatoes.
Pages: [1]   Go Up
 

Page created in 0.03 seconds with 20 queries.