fixes : ps

This commit is contained in:
VE10-Sanjeev 2022-05-30 10:12:35 +05:30
parent 7193b97f20
commit a4c9a5f1af
3 changed files with 35 additions and 31 deletions

View File

@ -373,5 +373,5 @@ $route['deleteCalenderEvent'] = 'PD_Controller/deleteCalenderEvent'; //only deve
$route['getSalesPDReportforCETApp'] = 'Sales_PD_Controller/getSalesPDReportforCETApp'; $route['getSalesPDReportforCETApp'] = 'Sales_PD_Controller/getSalesPDReportforCETApp';
$route['getCreditPDReportforCETApp'] = 'SMC_Credit_PD_Controller/getCreditPDReportforCETApp'; $route['getCreditPDReportforCETApp'] = 'SMC_Credit_PD_Controller/getCreditPDReportforCETApp';
// $route['faceMarkImage'] = 'PD_Controller/toMakeFaceBoundingBox'; $route['faceMarkImage'] = 'PD_Controller/toMakeFaceBoundingBox';

View File

@ -989,7 +989,7 @@ class PD_Controller extends REST_Controller {
{ {
$pd_details['complete_override_data'] = json_encode($pd_details['complete_override_data']); $pd_details['complete_override_data'] = json_encode($pd_details['complete_override_data']);
$pd_details['completed_on'] = date('Y-m-d H:i:s'); $pd_details['completed_on'] = date('Y-m-d H:i:s');
log_message('ERROR',"PD Controller line no : 992 When Completed status means called (to Make FaceBoundingBox)"); log_message('ERROR',"In PD Controller @ line no : 992 (When Completed status means calling to Make FaceBoundingBox fns below");
$this->toMakeFaceBoundingBox($exist_pd_details); $this->toMakeFaceBoundingBox($exist_pd_details);
} }
@ -11948,11 +11948,12 @@ public function getCompaniesListsFromGeneralFormRawJSONV2_post()
public function toMakeFaceBoundingBox($master_details){ public function toMakeFaceBoundingBox($master_details){
// $pdid = $this->get('pd');//pdid 3184 comment this // $pdid = $this->get('pd');//pdid 3184 comment this
$pdid = $master_details[0]['pd_id']; $pdid = $master_details[0]['pd_id'];
log_message('ERROR',"PD Controller inside to Make FaceBoundingBox PDID : ".$pdid); log_message('ERROR',"In PD Controller @ line no : 11951 (to Make FaceBoundingBox called ) PDID : ".$pdid);
$bounding_box = array(); $bounding_box = array();
if(!empty($pdid)){ if(!empty($pdid)){
// $master_details = $this->PD_Model->getPDMasterDetails($pdid);//comment this // $master_details = $this->PD_Model->getPDMasterDetails($pdid);//comment this
if($master_details[0]['facemark_image_generated'] == 0){ if($master_details[0]['facemark_image_generated'] == 0){
log_message('ERROR',"In PD Controller @ line no : 11956 Facemark Image Generated : ".$master_details[0]['facemark_image_generated']);
$db_result = $this->PD_Model->selectCustomRecords(array('faceapi_result'),array('pd_id' => $pdid),PDTRIGGER); $db_result = $this->PD_Model->selectCustomRecords(array('faceapi_result'),array('pd_id' => $pdid),PDTRIGGER);
$string = $db_result[0]['faceapi_result']; $string = $db_result[0]['faceapi_result'];
// echo gettype($string); // echo gettype($string);
@ -11960,7 +11961,7 @@ public function getCompaniesListsFromGeneralFormRawJSONV2_post()
// echo gettype($my_array); // echo gettype($my_array);
if(!empty($my_array) && !empty($my_array["FaceMatches"])){ if(!empty($my_array) && !empty($my_array["FaceMatches"])){
$arr = $my_array["FaceMatches"]; $arr = $my_array["FaceMatches"];
log_message('ERROR',"to Make FaceBoundingBox FaceMatches array cnt : ".count($arr)); log_message('ERROR',"In PD Controller @ line no : 11964 to Make FaceBoundingBox FaceMatches array cnt : ".count($arr));
for($i=0;$i<count($arr);$i++){ for($i=0;$i<count($arr);$i++){
$bounding_box[$i] = $arr[$i]['Face']['BoundingBox']; $bounding_box[$i] = $arr[$i]['Face']['BoundingBox'];
$bounding_box[$i]['Similarity'] = $arr[$i]['Similarity']; $bounding_box[$i]['Similarity'] = $arr[$i]['Similarity'];
@ -11972,7 +11973,7 @@ public function getCompaniesListsFromGeneralFormRawJSONV2_post()
$bucketname = LENDER_BUCKET_NAME_PREFIX.$master_details[0]['fk_lender_id']; $bucketname = LENDER_BUCKET_NAME_PREFIX.$master_details[0]['fk_lender_id'];
$key = 'pd'.$pdid.'/'.$img_result[0]['pd_document_name']; $key = 'pd'.$pdid.'/'.$img_result[0]['pd_document_name'];
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes'); $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
log_message('ERROR',"to Make FaceBoundingBox FaceMatches singed_uri : ".$singed_uri); log_message('ERROR',"In PD Controller @ line no : 11973 to Make FaceBoundingBox FaceMatches singed_uri : ".$singed_uri);
// $temp_image_name = "sample.png"; // $temp_image_name = "sample.png";
$temp_image_name = "face_api_image.jpeg"; $temp_image_name = "face_api_image.jpeg";
@ -11986,35 +11987,37 @@ public function getCompaniesListsFromGeneralFormRawJSONV2_post()
$bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile); $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile);
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data); $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
log_message('ERROR',"to Make FaceBoundingBox s3result : ".$s3result['@metadata']['statusCode']); log_message('ERROR',"In PD Controller @ line no : 11990 to Make FaceBoundingBox FaceMatches s3result : ".$s3result['@metadata']['statusCode']);
// print_r($s3result);die(); // print_r($s3result);die();
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
{ {
log_message('ERROR',"to Make FaceBoundingBox updating pdtrigger table facemark_image_generated as 1"); log_message('ERROR',"In PD Controller @ line no : 11996 to Make FaceBoundingBox updating pdtrigger table facemark_image_generated as 1");
//Update //Update
$this->db->WHERE('pd_id',$pdid)->UPDATE(PDTRIGGER,array('facemark_image_generated' => 1)); $this->db->WHERE('pd_id',$pdid)->UPDATE(PDTRIGGER,array('facemark_image_generated' => 1));
log_message('ERROR',"save document table face_api_result_image after unlink"); log_message('ERROR',"In PD Controller @ line no : 11998 to Make FaceBoundingBox save document table face_api_result_image after unlink");
$record_data = array('fk_pd_id' => $pdid,'pd_document_title'=>'face_api_result_image','pd_document_name'=>$temp_image_name); $record_data = array('fk_pd_id' => $pdid,'pd_document_title'=>'face_api_result_image','pd_document_name'=>$temp_image_name);
$this->PD_Model->saveRecords($record_data,PDDOCUMENTS); $this->PD_Model->saveRecords($record_data,PDDOCUMENTS);
unlink($destination_path); unlink($destination_path);
} }
// $data['dataStatus'] = true; // $data['dataStatus'] = true;
// $data['status'] = REST_Controller::HTTP_OK; // $data['status'] = REST_Controller::HTTP_OK;
// $data['msg'] = 'Given PDID '; // $data['msg'] = 'Success ';
// $data['details'] = $bounding_box; // $data['details'] = $bounding_box;
} }
// else{ else{
// $data['dataStatus'] = false; log_message('ERROR',"In PD Controller @ line no : 12009 to Make FaceBoundingBox Faceapi Image Already Generated");
// $data['status'] = REST_Controller::HTTP_NO_CONTENT; // $data['dataStatus'] = false;
// $data['msg'] = 'Given PDID is Not in Completed Status'; // $data['status'] = REST_Controller::HTTP_NO_CONTENT;
// } // $data['msg'] = 'Faceapi Image Already Generated';
}
}
else{
log_message('ERROR',"In PD Controller @ line no : 12016 to Make FaceBoundingBox PDID is Not Available");
// $data['dataStatus'] = false;
// $data['status'] = REST_Controller::HTTP_NO_CONTENT;
// $data['msg'] = 'PDID is Not Available';
} }
// else{
// $data['dataStatus'] = false;
// $data['status'] = REST_Controller::HTTP_NO_CONTENT;
// $data['msg'] = 'PDID is Not Available';
// }
// $this->response($data,REST_Controller::HTTP_OK); // $this->response($data,REST_Controller::HTTP_OK);
} }

View File

@ -3,26 +3,26 @@
class faceapi class faceapi
{ {
public static function toMakeFaceBoundingBox($image_name,$BoundingBox,$destination_path){ public static function toMakeFaceBoundingBox($image_name,$BoundingBox,$destination_path){
log_message('ERROR','####faceapi helper to Make FaceBoundingBox fns'); log_message('ERROR',"In faceapi helper @ line no : 6 to Make FaceBoundingBox");
$get_image_format = explode(".",$image_name); $get_image_format = explode(".",$image_name);
$image_format = $get_image_format[1]; $image_format = $get_image_format[1];
log_message('ERROR','####faceapi helper to Make FaceBoundingBox image_format'.$image_format); log_message('ERROR','In faceapi helper @ line no : 9 to Make FaceBoundingBox image_format :'.$image_format);
// print_r($get_image_format);die(); // print_r($get_image_format);die();
// $img = imagecreatefrompng($destination_path); $img = imagecreatefrompng($destination_path);
if($image_format == 'png'){ // if($image_format == 'png'){
$img = imagecreatefrompng($destination_path); // $img = imagecreatefrompng($destination_path);
}else if($image_format == 'jpeg'){ // }else if($image_format == 'jpeg'){
$img = imagecreatefromjpeg($destination_path); // $img = imagecreatefromjpeg($destination_path);
}else if($image_format == 'jpg'){ // }else if($image_format == 'jpg'){
$img = imagecreatefromjpg($destination_path); // $img = imagecreatefromjpg($destination_path);
} // }
$red = imagecolorallocate($img, 255, 0, 0); $red = imagecolorallocate($img, 255, 0, 0);
$black = imagecolorallocate($img, 0, 0, 0); $black = imagecolorallocate($img, 0, 0, 0);
$white = imagecolorallocate($img, 255, 255, 255); $white = imagecolorallocate($img, 255, 255, 255);
list($imagewidth, $imageheight) = getimagesize($destination_path); list($imagewidth, $imageheight) = getimagesize($destination_path);
log_message('ERROR','####faceapi helper to Make FaceBoundingBox image_width'.$imagewidth.'image_height'.$imageheight); log_message('ERROR','In faceapi helper @ line no : 25 to Make FaceBoundingBox image_width'.$imagewidth.'image_height'.$imageheight);
for($i=0;$i<count($BoundingBox);$i++){ for($i=0;$i<count($BoundingBox);$i++){
$Left_coordinate = ($BoundingBox[$i]['Left'] * $imagewidth) ; $Left_coordinate = ($BoundingBox[$i]['Left'] * $imagewidth) ;
@ -42,7 +42,7 @@ class faceapi
} }
public static function DrawLine($x1,$y1,$Face_width,$Face_height,$Similarity,$img,$destination_path){ public static function DrawLine($x1,$y1,$Face_width,$Face_height,$Similarity,$img,$destination_path){
log_message('ERROR','####faceapi helper Draw Line x1 : '.$x1.' y1 : '.$y1.' Face_width : '.$Face_width.' Face_height : '.$Face_height.' Similarity : '.$Similarity.' img : '.$img.' destination_path : '.$destination_path); log_message('ERROR','In faceapi helper @ line no : 45 Draw Line x1 : '.$x1.' y1 : '.$y1.' Face_width : '.$Face_width.' Face_height : '.$Face_height.' Similarity : '.$Similarity.' img : '.$img.' destination_path : '.$destination_path);
$Similarity_split = explode(".",$Similarity); $Similarity_split = explode(".",$Similarity);
$Similarity_value = $Similarity_split[0]; $Similarity_value = $Similarity_split[0];
list($imagewidth, $imageheight) = getimagesize($destination_path); list($imagewidth, $imageheight) = getimagesize($destination_path);
@ -51,6 +51,7 @@ class faceapi
}else if($Similarity_value < 70 ){// below 70 red }else if($Similarity_value < 70 ){// below 70 red
$color = imagecolorallocate($img, 255, 0, 0); $color = imagecolorallocate($img, 255, 0, 0);
} }
log_message('ERROR','In faceapi helper @ line no : 45 Draw Line color : '.$color);
$Similarity = $Similarity_value." %"; $Similarity = $Similarity_value." %";
//TOP LINe //TOP LINe
$t_x1 = $x1; $t_x1 = $x1;