imagettftext

imagettftext -- Write text to the image using TrueType fonts

Description

array imagettftext ( resource image, int size, int angle, int x, int y, int col, string fontfile, string text)

Depending on which version of the GD library that PHP is using , when fontfile does not begin with a leading ' / ' , '.ttf ' will be appended to the filename and the the library will attempt to search for that filename along a library-defined font path .

Angle is in degrees , with 0 degrees being left-to-right reading text ( 3 o'clock direction) , and higher values representing a counter-clockwise rotation . (i.e. , a value of 90 would result in bottom-to-top reading text ) .

Fontfile is the path to the TrueType font you wish to use .

Text is the text string which may include UTF-8 character sequences ( of the form : #123 ; ) to access characters in a font beyond the first 255 .

דוגמה 1 . imagettftext

 
?php

 
header

 
(

 
"Content-type

 
:

 
image

 
/

 
gif")

 
;

 
$im

 
=

 
imagecreate

 
(400

 
,

 
30)

 
;

 
$black

 
=

 
imagecolorallocate

 
($im

 
,

 
0

 
,

 
0

 
,

 
0)

 
;

 
$white

 
=

 
imagecolorallocate

 
($im

 
,

 
255

 
,

 
255

 
,

 
255)

 
;

 
imagettftext

 
($im

 
,

 
20

 
,

 
0

 
,

 
10

 
,

 
20

 
,

 
$white

 
,

 
"

 
/

 
path

 
/

 
arial.ttf"

 
,

 
"Testing...Omega

 
:

 
#937

 
;")

 
;

 
imagegif

 
($im)

 
;

 
imagedestroy

 
($im)

 
;

 
?