Page 23 - Open Soource Technologies 304.indd
P. 23
Unit 1: Introduction to PHP
Notes
ImageTTFText($im, $size, 0, $x, $y, $black, $font, $_GET[‘message’]); // return image
header(‘Content-type: image/png’);
ImagePNG($im);
exit;
}
?>
<html>
<head>
<title>Button Form</title>
</head>
<body> <form action=”<?= $PHP_SELF ?>” method=”GET”> Enter message to appear on button:
<input type=”text” name=”message” /><br />
<input type=”submit” value=”Create Button” />
</form>
</body>
</html>
The form generated by example is shown in Figure 1.11. The button created is shown in Figure 1.12.
Figure 1.11: Button-creation Form
Enter message to appear on button: PHP Button
Create Button
Figure 1.12: Button Created
PHP Button
You can use GD to dynamically resize images, produce graphs, and much more. PHP also has
several extensions to generate documents in Adobe’s popular PDF format.
Do not compile PHP without specifying a specific web server type; otherwise
you will get a PHP interpreter as a program on the place of a web server
module.
1.4.5 From the Shell
PHP scripts that use PHP functionality such as databases and graphics and yet are callable from
the command line.
LOVELY PROFESSIONAL UNIVERSITY 17