$val) { $nr++; $text_color = imagecolorallocate($im, $tc[$nr][0], $tc[$nr][1], $tc[$nr][2]); $_b = imageTTFBbox($fsize,0,$font,$val); $_W = abs($_b[2]-$_b[0]); //Defining the X coordinate. $_X = 0;//abs($W/2)-abs($_W/2); //Defining the Y coordinate. $_H = abs($_b[5]-$_b[3]); $__H += 20;//$_H; imagettftext($im, $fsize, $angle, $X, $__H, $text_color, $font, $val); // $__H += $fsize/2; } } elseif ($L_R_C == 1) { //Justify Right $s = split("[\n]+", $text); $__H = 0;//$fsize/2;//0; foreach($s as $key => $val){$nr++; $text_color = imagecolorallocate($im, $tc[$nr][0], $tc[$nr][1], $tc[$nr][2]); $_b = imageTTFBbox($fsize,0,$font,$val); $_W = abs($_b[2]-$_b[0]); //Defining the X coordinate. $_X = $W-$_W-12; //Defining the Y coordinate. // $_H = abs($_b[5]-$_b[3]); $__H += 20;//$_H; imagettftext($im, $fsize, $angle, $_X, $__H, $text_color, $font, $val); // $__H += $fsize/2; } } elseif($L_R_C == 2){ //Justify Center $s = split("[\n]+", $text); $__H = 0;//$fsize/2;//0; foreach($s as $key => $val) { $nr++; $text_color = imagecolorallocate($im, $tc[$nr][0], $tc[$nr][1], $tc[$nr][2]); $_b = imageTTFBbox($fsize,0,$font,$val); $_W = abs($_b[2]-$_b[0]); //Defining the X coordinate. $_X = abs($W/2)-abs($_W/2)-12; //Defining the Y coordinate. $_H = abs($_b[5]-$_b[3]); $__H += 20;//$_H; imagettftext($im, $fsize, $angle, $_X, $__H, $text_color, $font, $val); // $__H += $fsize/2; } } return $im; } ?>