I want to write text onto a PNG, since 8.1 I'm getting a warning
PHP Deprecated: Implicit conversion from float 5.5 to int loses precision
for line
imagefttext($im, 35, 1, $x, $y, $orange, $font, $ausgabecode);
The whole code:
header("Content-type: image/png");
$text = "12345";
$im = imagecreatefrompng("background.png");
$color = imagecolorallocate($im, 255, 255, 255);
$font = './myfont2.ttf';
$bbox = imageftbbox(35, 2, $font, $text);
$x = $bbox[0] + (imagesx($im) / 2) - ($bbox[4] / 2) - 4;
$y = $bbox[1] + (imagesy($im) / 2) - ($bbox[5] / 2) - 5;
if($x < 1){
$x = $x + 1;
}
imagefttext($im, 35, 1, $x, $y, $color, $font, $text);
imagepng($im);
imagedestroy($im);
How do I treat x,y as float at all times?