I've some code like this:
<?php
$file = fopen("inputfile.txt", "r");
$i = 0;
while (!feof($file)) {
    $line_of_text .= fgets($file);
}
$myText = explode("\n", $line_of_text);
fclose($file);
print_r($myText);
$arrayCount = count($myText);
for ($x = 0; $x < $arrayCount; $x++) {
    $image = imagecreatefromjpeg('flower.jpg');
    // First we create our stamp image manually from GD
    $stamp = imagecreatetruecolor(200, 70);
    imagefilledrectangle($stamp, 0, 0, 199, 169, 0x0000FF);
    imagefilledrectangle($stamp, 9, 9, 190, 60, 0xFFFFFF);
    imagestring($stamp, 5, 20, 20, $myText[$x], 0x0000FF);
    imagestring($stamp, $myFont, 20, 40, '(c) 2017', 0x0000FF);
    //imagettftext ( $stamp, 5, 0, 20, 20, 20, 'arial.ttf' , "thanks!");
    // Set the margins for the stamp and get the height/width of the stamp image
    $right = 250;
    $bottom = 250;
    $sx = imagesx($stamp);
    $sy = imagesy($stamp);
    // Merge the stamp onto our photo with an opacity of 50%
    imagecopymerge($image, $stamp, imagesx($image) - $sx - $right, imagesy($image) - $sy - $bottom, 0, 0, imagesx($stamp), imagesy($stamp), 40);
    // Save the image to file and free memory
    imagepng($image, 'flower_stamp-'.$x.'.png');
    imagedestroy($image);
}
?>
And the inputfile.txt is like this:
Category Name 1
Category Name 2
Category Name 3
When I run this code it will generate new images with watermark.
The problem is I'm using imagestring and I can't define my custom font.
How can I change the font family before watermark?
