PHP | imageloadfont() Function Last Updated : 14 Feb, 2020 Comments Improve Suggest changes Like Article Like Report The imageloadfont() function is an inbuilt function in PHP which is used to load a new font. GDF fonts are supported which can be downloaded from here. Syntax: int imageloadfont( string $file ) Parameters: This function accepts a single parameter $file which holds the font. Return Value: This function returns font identifier which is always bigger than 5 to avoid conflicts with built-in fonts or FALSE on errors. Below given programs illustrate the imageloadfont() function in PHP: Program 1 (Writing on a drawing): php <?php // Create a new image instance $im = imagecreatetruecolor(105, 15); // Prepare the colors $black = imagecolorallocate($im, 0, 0, 0); $white = imagecolorallocate($im, 255, 255, 255); // Make the background white imagefilledrectangle($im, 0, 0, 700, 250, $white); // Load the gd font from local folder // and write 'GeeksforGeeks' $font = imageloadfont('./Hollow_8x16_LE.gdf'); imagestring($im, $font, 0, 0, 'GeeksforGeeks', $black); // Scale the image bigger $im1 = imagescale($im, 700); // Output to browser header('Content-type: image/png'); imagepng($im1); imagedestroy($im); ?> Output: Program 2 (Writing on an image): php <?php // Create an image instance $im = imagecreatefrompng( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); // Prepare the red color $red = imagecolorallocate($im, 255, 0, 0); // Load the gd font from local folder and write 'GeeksforGeeks' $font = imageloadfont('./Hollow_8x16_LE.gdf'); imagestring($im, $font, 200, 100, 'GeeksforGeeks', $red); // Output to browser header('Content-type: image/png'); imagepng($im); imagedestroy($im); ?> Output: Reference: https://www.php.net/manual/en/function.imageloadfont.php Comment G gurrrung Follow 0 Improve G gurrrung Follow 0 Improve Article Tags : Web Technologies PHP PHP-function PHP-image-functions Explore PHP Tutorial 8 min read BasicsPHP Syntax 4 min read PHP Variables 5 min read PHP | Functions 8 min read PHP Loops 4 min read ArrayPHP Arrays 5 min read PHP Associative Arrays 4 min read Multidimensional arrays in PHP 5 min read Sorting Arrays in PHP 4 min read OOPs & InterfacesPHP Classes 2 min read PHP | Constructors and Destructors 5 min read PHP Access Modifiers 4 min read Multiple Inheritance in PHP 4 min read MySQL DatabasePHP | MySQL Database Introduction 4 min read PHP Database connection 2 min read PHP | MySQL ( Creating Database ) 3 min read PHP | MySQL ( Creating Table ) 3 min read PHP AdvancePHP Superglobals 6 min read PHP | Regular Expressions 12 min read PHP Form Handling 4 min read PHP File Handling 4 min read PHP | Uploading File 3 min read PHP Cookies 9 min read PHP | Sessions 7 min read Like