I made a small code to make a random text-sig some while ago, and today I added Sign the Petition to it, but I realised it was too small to fit the text, so I made it double the size, but not it doesn't look nice with smaller texts anymore...
Anywaaaay, what im trying to ask is
, can someone help me to make it auto-adjust the size to the text.
I already tried it with
imagettfbox but couldn't get it to work. Because I don't think my server can use ttf font's, and I can't change any settings cause it's my hosting company's server.
TIA
And below my code
code:
<?php
//randomizer
srand((float) microtime() * 10000000);
$input = array("Ezra", "TSDME", "MsgPlus!", "Nintendo", "SPAM", "Web2Messenger", "Sign the Petition");
$rand_keys = array_rand($input, 2);
$string = $input[$rand_keys[0]];
//Header info
header("Content-type: image/gif");
//
$im = @imagecreate(160, 20);
$background_color = imagecolorallocate($im, 100, 100, 100);
$text_color = imagecolorallocate($im, 000, 000, 200);
//
imagecolortransparent($im, $background_color);
imagestring($im, 5, 7, 3, $string, $text_color);
imagegif($im);
imagedestroy($im);
//statistics
include_once('connection.inc.php');
opendb();
$query = "SELECT * FROM stats";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
$sts = ($row[stats]) + 1;
}
$sql = "UPDATE stats
SET stats = '$sts'";
mysql_query($sql);
?>