Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function LoadPNG($imgname)
- {
- /* Attempt to open */
- $im = @imagecreatefrompng($imgname);
- /* See if it failed */
- if(!$im)
- {
- /* Create a blank image */
- $im = imagecreatetruecolor(150, 30);
- $bgc = imagecolorallocate($im, 255, 255, 255);
- $tc = imagecolorallocate($im, 0, 0, 0);
- imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
- /* Output an error message */
- imagestring($im, 1, 5, 5, 'Error loading ' . $imgname, $tc);
- }
- return $im;
- }
- $username = "your_name";
- $password = "your_password";
- $hostname = "localhost";
- //connection to the database
- $dbhandle = mysql_connect($hostname, $username, $password)
- or die("Unable to connect to MySQL");
- echo "Connected to MySQL<br>";
- //select a database to work with
- $selected = mysql_select_db("examples",$dbhandle)
- or die("Could not select examples");
- //haal getal uit database
- $number = '10';
- //close the connection
- mysql_close($dbhandle);
- $im = LoadPNG('test.png');
- $black = imagecolorallocate($im, 0, 0, 0);
- $text = "Kills: $number";
- imagestring($im, 5, 5, 85, $text, $black);
- header('Content-type: image/png');
- imagepng($im);
- imagedestroy($im);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement