PHP | imageftbbox() Function Last Updated : 14 Feb, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The imageftbbox() function is an inbuilt function in PHP which is used to calculate the bounding box of a text using fonts via freetype2. Syntax: array imageftbbox( float $size, array $angle, string $fontfile, string $text, array $extrainfo ) Parameters: This function accept five parameters as mentioned above and described below: $size: It specifies the font size in points. $angle: It specifies the angle in degrees in which text will be measured. $fontfile: It specifies the font filename. $text: It specifies the string to be measured. $extrainfo (Optional): It specifies the extra information. Return Value: This function returns an array on success. Below given programs illustrate the imageftbbox() function in PHP: Program 1: php <?php // Create bounding box with local font file $bbox = imageftbbox(100, 100, './Pacifico.ttf', 'GeeksforGeeks'); // Print the boundbox data print("<pre>".print_r($bbox, true)."</pre>"); ?> Output: Array ( [0] => 47 [1] => -13 [2] => -91 [3] => -806 [4] => -264 [5] => -776 [6] => -124 [7] => 17 ) Program 2: php <?php // Create an image $im = imagecreatetruecolor(800, 250); // Set the background to be light blue imagefilledrectangle($im, 0, 0, 299, 299, imagecolorallocate($im, 0, 0, 100)); // Create bounding box with local font file $bbox = imageftbbox(10, 0, './Pacifico.ttf', 'GeeksforGeeks'); // Calculate coordinates using bounding box $x = $bbox[0] + 130; $y = $bbox[1] + 130; // Add text imagefttext($im, 50, 0, $x, $y, imagecolorallocate($im, 0, 150, 0), './Pacifico.ttf', 'GeeksforGeeks'); // Output to browser header('Content-Type: image/png'); imagepng($im); imagedestroy($im); ?> Output: Reference: https://www.php.net/manual/en/function.imageftbbox.php Comment More infoAdvertise with us Next Article PHP | imagettftext() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | imagettfbbox() Function The imagettfbbox() function is an inbuilt function in PHP that is used to calculate the bounding box in pixels for a TrueType text.Syntax:Â Â array imagettfbbox( float $size, float $angle, string $fontfile, string $text) Parameters: This function accepts four parameters as mentioned above and describ 2 min read PHP | imagefttext() Function The imagefttext() function is an inbuilt function in PHP which is used write text to the image using fonts using FreeType 2. Syntax: array imagefttext( resource $image, float $size, float $angle, int $x, int $y, int $color, string $fontfile, string $text, array $extrainfo ) Parameters: This function 2 min read PHP | imagettftext() Function The imagettftext() function is an inbuilt function in PHP which is used to write text to the image using TrueType fonts. Syntax: array imagettftext( resource $image, float $size, float $angle, int $x, int $y, int $color, string $fontfile, string $text) Parameters: This function accept eight paramete 2 min read PHP | imagesx() Function The imagesx() function is an inbuilt function in PHP which is used to return the width of the given image. Syntax: int imagesx( $image ) Parameters: This function accepts single parameters $image which is mandatory. This $image variable can store the image created by imagecreatetruecolor() image cre 1 min read PHP | imagexbm() Function The imagexbm() function is an inbuilt function in PHP which is used to display image to browser a file. The main use of this function is to view an image in the browser and convert any other image type to XBM. Syntax: bool imagexbm( resource $image, int $to, int $foreground) Parameters: This functio 2 min read PHP | imagegif() Function The imagegif() function is an inbuilt function in PHP which is used to create the GIF image file from the given image. If the image has been made transparent with imagecolortransparent() function, then GIF89a image format will generate otherwise GIF87a image format will generate. Syntax: bool imageg 2 min read Like