= 70 ){// above 70 green $color = imagecolorallocate($img, 0, 153, 0); }else if($Similarity_value < 70 ){// below 70 red $color = imagecolorallocate($img, 255, 0, 0); } $white = imagecolorallocate($img, 255, 255, 255); log_message('ERROR','In faceapi helper @ line no : 45 Draw Line color : '.$color); $Similarity = $Similarity_value." %"; //TOP LINe $t_x1 = $x1; $t_y1 = $y1; $t_x2 = ($x1+$Face_width); $t_y2 = $y1; //bottom line $b_x1 = $x1; $b_y1 = ($y1+$Face_height); $b_x2 = ($x1+$Face_width); $b_y2 = ($y1+$Face_height); $imgl = self::imagelinethick($img,$t_x1,$t_y1,$t_x2,$t_y2,$color,7);//top line $imgl = self::imagelinethick($img,$b_x1,$b_y1,$b_x2,$b_y2,$color,7);//bottom line $imgl = self::imagelinethick($img,$t_x1,$t_y1,$b_x1,$b_y1,$color,7);//left line $imgl = self::imagelinethick($img,$t_x2,$t_y2,$b_x2,$b_y2,$color,7);//right line // apppath / doc la roboto.tff $font = APPPATH."docs/roboto.ttf"; // imagettftext($img, 20, 0, ($t_x1), ($t_y1-5), $color,$font, $Similarity); // imagepng($img, $destination_path); // imagepng($img, "face4.png"); // imagefilledrectangle($img, $t_x1-5, $t_y1-18, $t_x1+28, $t_y1, $white); // imagettftext($img, 10, 10, ($t_x1), ($t_y1-5), $color,$font, $Similarity); imagefilledrectangle($img, $t_x1-5, $t_y1-30, $t_x1+60, $t_y1, $white); imagettftext($img, 17, 8, ($t_x1), ($t_y1-5), $color,$font, $Similarity); $get_image_format = explode(".",$destination_path); $image_format = $get_image_format[1]; if($image_format == 'png'){ imagepng($img, $destination_path); }else if($image_format == 'jpeg'){ imagejpeg($img, $destination_path); }else if($image_format == 'jpg'){ // $destination_path = $get_image_format[0].".jpeg"; imagejpg($img, $destination_path); } } public static function imagelinethick($image, $x1, $y1, $x2, $y2, $color, $thick = 1) { /* this way it works well only for orthogonal lines imagesetthickness($image, $thick); return imageline($image, $x1, $y1, $x2, $y2, $color); */ if ($thick == 1) { return imageline($image, $x1, $y1, $x2, $y2, $color); } $t = $thick / 2 - 0.5; if ($x1 == $x2 || $y1 == $y2) { return imagefilledrectangle($image, round(min($x1, $x2) - $t), round(min($y1, $y2) - $t), round(max($x1, $x2) + $t), round(max($y1, $y2) + $t), $color); } $k = ($y2 - $y1) / ($x2 - $x1); //y = kx + q $a = $t / sqrt(1 + pow($k, 2)); $points = array( round($x1 - (1+$k)*$a), round($y1 + (1-$k)*$a), round($x1 - (1-$k)*$a), round($y1 - (1+$k)*$a), round($x2 + (1+$k)*$a), round($y2 - (1-$k)*$a), round($x2 + (1-$k)*$a), round($y2 + (1+$k)*$a), ); imagefilledpolygon($image, $points, 4, $color); return imagepolygon($image, $points, 4, $color); } } ?>