I am able to render the PHP GD image just fine on my localhost, but when I upload it to my Linux Ubuntu Debian LAMP server, the font or text is missing and only the background color shows. So the image is being generated, but it is just missing the text that belongs in the image.
I currently have PHP 7.2 and the GD 7.2 library installed. It is also showing in my php.ini file that I’ve enabled it and even removed the semicolon to ensure it’s enabled as well.
Here is the code that I’m working with:
<?php //create the php image header('Content-type: image/jpeg'); $img = imagecreate(200, 60); $background = imagecolorallocate($img, 1,49,31); $textColor = imagecolorallocate($img, 255, 255, 255); $font = "roboto.ttf"; imagettftext($img, 28, 10, 40, 50, $textColor, $font, "MY TEXT GOES HERE!"); imagejpeg($img); imagedestroy($img); ?>
Any clue what else would be preventing the text from appearing?