I have some questions.. Whenever I try to edit text generated over this image, everything stops working. This is my raw version of the code. How can I change font style and size? $fontSize doesn't work and if I add something like $fontPath = 'URL'; and add $fontPath to imagestring, everything stops working too. How can I automatically center text with $x?
index.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example</title>
</head>
<body>
<h1>Example</h1><br/>
<img src="image.php"/>
</body>
</html>
image.php
<?php
header("Content-type: image/jpeg");
$imgPath = 'https://i.imgur.com/GvB85NN.jpg';
$image = imagecreatefromjpeg($imgPath);
$color = imagecolorallocate($image, 255, 255, 255);
$string = "test";
$fontSize = 20;
$x = 185;
$y = 185;
imagestring($image, $fontSize, $x, $y, $string, $color);
imagejpeg($image);
// $font_file
?>