imagefttext
Write text to the image using fonts using FreeType 2.
imagefttext Function synopsis
imagefttext(
GdImage $image,
float $size,
float $angle,
int $x,
int $y,
int $color,
string $font_filename,
string $text,
array $options = []
): array|false
Parameters
$image
TypeGdImage
$size
Typefloat
The font size to use in points.
$angle
Typefloat
The angle in degrees, with 0 degrees being left-to-right reading text. Higher values represent a counter-clockwise rotation. For example, a value of 90 would result in bottom-to-top reading text.
$x
Typeint
The coordinates given by $x and
$y will define the basepoint of the first
character (roughly the lower-left corner of the character). This
is different from the imagestring, where
$x and $y define the
upper-left corner of the first character. For example, "top left"
is 0, 0.
$y
Typeint
The y-ordinate. This sets the position of the fonts baseline, not the very bottom of the character.
$color
Typeint
The index of the desired color for the text, see
imagecolorexact.
$font_filename
Typestring
The path to the TrueType font you wish to use.
$text
Typestring
Text to be inserted into image.
$options
OptionalTypearrayDefault value[]
Return value
Typearray|false
This function returns an array defining the four points of the box, starting in the lower left and moving counter-clockwise:
On failure, false is returned.
Changes to the imagefttext Function
PHP 8.0
- Return type added:
array|false - Parameter name of parameter #1 changed:
$imto$image - Parameter type added for parameter #1 (
$image):GdImage - Parameter type added for parameter #2 (
$size):float - Parameter type added for parameter #3 (
$angle):float - Parameter type added for parameter #4 (
$x):int - Parameter type added for parameter #5 (
$y):int - Parameter name of parameter #6 changed:
$colto$color - Parameter type added for parameter #6 (
$color):int - Parameter name of parameter #7 changed:
$font_fileto$font_filename - Parameter type added for parameter #7 (
$font_filename):string - Parameter type added for parameter #8 (
$text):string - Parameter name of parameter #9 changed:
$extrainfoto$options - Parameter type added for parameter #9 (
$options):array - Parameter default value added for position #9 (
$options):[]
imagefttext(
- $im,
+ GdImage $image,
- $size,
+ float $size,
- $angle,
+ float $angle,
- $x,
+ int $x,
- $y,
+ int $y,
- $col,
+ int $color,
- $font_file,
+ string $font_filename,
- $text,
+ string $text,
- $extrainfo
+ array $options = []
- )
+ ): array|false imagefttext Function Availability
imagefttext Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Upcoming Release | Yes |
| PHP 8.5Supported (Latest) | Yes |
| PHP 8.4Supported | Yes |
| PHP 8.3Security-Fixes Only | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Unsupported | Yes |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | Yes |
| PHP 7.0Unsupported | Yes |
| PHP 5.6Unsupported | Yes |
| PHP 5.5Unsupported | Yes |
| PHP 5.4Unsupported | Yes |
| PHP 5.3Unsupported | Yes |