imagettftext only availablöe in PHP 7.2 and not in 8.1?

55 Views Asked by At

I am using the following code to display a capcha

    $img = ImageCreateFromPNG('captcha2.png');
    $color = ImageColorAllocate($img, 140, 140, 140);
    $ttf = 'bodoni_bk_bt.ttf';
    $ttfsize = 32;
    $angle = rand(-8,8);
    $t_x = rand(5,50);
    $t_y = 50;
    imagettftext($img, $ttfsize, $angle, $t_x, $t_y, $color, $ttf, $text);
    imagepng($img);
    imagedestroy($img);

In one of my websites (at ionos.de - former 1und1) the capcha-text is only being displayed under PHP 7.2. Switching to 7.4 or higher the function is no longer available.

On another website of mine the code is working perfectly under PHP 8.1. Does somebody has an idea what is going on or has an solution?

Manfred

0

There are 0 best solutions below