Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Content-type: image/png");
- $sql_handle = mysql_connect('localhost', 'phptest', 'alpine');
- $IMG_base = imagecreatefrompng("bg.png");
- $black = imagecolorallocate($IMG_base, 255, 255, 255);
- $font = './tahoma.ttf';
- if ($sql_handle)
- {
- //we are connected, resolve the stuff:
- $db = mysql_select_db('dynSig', $sql_handle);
- if (!$db) die(mysql_error());
- $dbquery = "SELECT * FROM chatInfo ORDER BY TIME DESC LIMIT 5";
- $result = mysql_query($dbquery, $sql_handle);
- if (!$result) die(mysql_error());
- $px = 13;
- $py = 10;
- for($i=0; $i<3; $i++)
- {
- $name = mysql_result($result, $i, 'name');
- $text = mysql_result($result, $i, 'text');
- $string = '<' . $name . '> ' . $text;
- $py = $py + 15;
- imagefttext($IMG_base, 10, 0, $px, $py, $black, $font, $string);
- }
- //image drawing stuff goes here
- imagepng($IMG_base);
- imagedestroy($IMG_base);
- } else {
- //handling routine goes here
- echo "Cannae connect :()";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement