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:
Output:
Array
(
[0] => 47
[1] => -13
[2] => -91
[3] => -806
[4] => -264
[5] => -776
[6] => -124
[7] => 17
)
Program 2:
Output:
👁 Image
Reference: https://www.php.net/manual/en/function.imageftbbox.php