DJ Mike's Tutorials: PHP

< ^ >

Using Built In Fonts

imagestring()

PHP has built in fonts that you can use. The are not very pretty and even the biggest possible size isn't easy to read with a WebTV but they are easy to use in basic applications. To draw text horizontally you use imagestring(). imagestring() accepts five arguments; a image resource, font size, x-coordinate, y-coordinate, a string variable and a color resource.

<?
imagestring 
$image$size$x$y"Text string"$color );
?>


Font size can be 1 to 5. $x is the coordinate of the upper left corner and $y is the coordinate of the upper left corner. The image below uses a for loop to loop through the five font sizes and move the y cooridinate down.



Show Image Show Source Code

Show Image Show Source Code

imagestringup()

imagestringup() has the same syntax as imagestring but draws the text string vertically. The example below loops throught the font sizes but draws the the vertically and moves the x cooridinate right



Show Image Show Source Code

Show Image Show Source Code


< ^ >


Was this webpage useful to you? You can support this website by donating.


Created by DJ Mike from Santa Barbara

DJ Mike


<a href="http://www.statcounter.com/" target="_blank"> <img src="http://c5.statcounter.com/counter.php?sc_project=1321035&java=0&security=da2193dc" alt="counter free hit invisible" border="0" /></a>