createCaptchaString example

$this->container->get('session')->offsetSet(self::SESSION_KEY, $captchaArray);

        return true;
    }

    /** * {@inheritdoc} */
    public function getTemplateData()
    {
        $string = $this->createCaptchaString();

        $imgResource = $this->getImageResource($string);

        ob_start();
        imagepng($imgResource, null, 9);
        $img = (string) ob_get_clean();
        imagedestroy($imgResource);
        $img = base64_encode($img);

        /** @var string[] $sRandArray */
        $sRandArray = $this->container->get('session')->get(self::SESSION_KEY, []);

        
Home | Imprint | This part of the site doesn't use cookies.