function createCategoryHeader($id,$colour,$text,$lng){ #change the hex colour to rgb $rgb = hex2rgb($colour); # set up text $pointSize = 22; $font = "/var/www/fonts/NewsGothicBT.ttf"; $bbox=imagettfbbox($pointSize,0,$font,$text); $textWidth = $bbox[2] - $bbox[0]; $textHeight = abs($bbox[7] - $bbox[1]); $baseline = abs(0 - $bbox[7]); $img = imagecreate($textWidth+2,$textHeight+2); $bg = imagecolorallocate($img,$rgb[0],$rgb[1],$rgb[2]); $white = imagecolorallocate($img,255,255,255); imagefill($img,0,0,$bg); imagettftext ($img, $pointSize, 0, 0, $baseline, $white, $font, $text); imagepng($img,"/var/www/development/shop/skin1/images/".$lng."/tt_category_header".$id.".png"); imagedestroy($img); }