Code:
<?php
header("Content-type: image/png");
//$mysql = mysql_connect("localhost","user","pass");
//$db = mysql_select_db("migt");
//$user = mysql_real_escape_string($_GET['uid']);
//$query = "SELECT * FROM migt WHERE uid='" . $user . "'";
//$query = mysql_query($query);
//$query = @mysql_fetch_array($query);
// THIS IS TEMPORARY:
$query['display'] = "tech star";
function hex2string($image, $hex){
$hex = str_split($hex,"2");
$hex[0]=hexdec($hex[0]);
$hex[1]=hexdec($hex[1]);
$hex[2]=hexdec($hex[2]);
$color=imagecolorallocate($image, $hex[0], $hex[1], $hex[2]);
return $color;
}
function write_text($image, $txtsize, $x, $y, $string, $hex, $font){
$color = hex2string($image, $hex);
imagettftext($image,$txtsize,0,$x,$y,$color,$font,$string);
}
function addimage($new, $image, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h){
$new = imagecreatefrompng($new);
imagecopy($image,$new,$dst_x,$dst_y,$src_x,$src_y,$src_w,$src_h);
imagedestroy($new);
}
function center($string,$start,$px){
$ssize = imagettfbbox($px, "0", "calibri.ttf", $string);
$dsize = $start - $ssize[4];
$dsize = $dsize / 2;
return $dsize;
}
$image = imagecreatefrompng("gt1.png");
addimage("apache_pb.png",$image,2,3,1,1,76,71);
write_text($image, 16,center($query['display'], 86, 225, 16),45,$query['display'],"FFFFFF","calibri.ttf");
imagepng($image);
imagedestroy($image);
?>
//
//
Is there any way I can fix this?