From a4c9a5f1af40075e4b9cece5b2d38215f61a37c1 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Mon, 30 May 2022 10:12:35 +0530 Subject: [PATCH] fixes : ps --- api/application/config/routes.php | 2 +- api/application/controllers/PD_Controller.php | 39 ++++++++++--------- api/application/helpers/faceapi_helper.php | 25 ++++++------ 3 files changed, 35 insertions(+), 31 deletions(-) diff --git a/api/application/config/routes.php b/api/application/config/routes.php index c2c7e0d1..b4619e10 100755 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -373,5 +373,5 @@ $route['deleteCalenderEvent'] = 'PD_Controller/deleteCalenderEvent'; //only deve $route['getSalesPDReportforCETApp'] = 'Sales_PD_Controller/getSalesPDReportforCETApp'; $route['getCreditPDReportforCETApp'] = 'SMC_Credit_PD_Controller/getCreditPDReportforCETApp'; -// $route['faceMarkImage'] = 'PD_Controller/toMakeFaceBoundingBox'; +$route['faceMarkImage'] = 'PD_Controller/toMakeFaceBoundingBox'; diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index c8fe85c4..224505e1 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -989,7 +989,7 @@ class PD_Controller extends REST_Controller { { $pd_details['complete_override_data'] = json_encode($pd_details['complete_override_data']); $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); } @@ -11948,11 +11948,12 @@ public function getCompaniesListsFromGeneralFormRawJSONV2_post() public function toMakeFaceBoundingBox($master_details){ // $pdid = $this->get('pd');//pdid 3184 comment this $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(); if(!empty($pdid)){ // $master_details = $this->PD_Model->getPDMasterDetails($pdid);//comment this 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); $string = $db_result[0]['faceapi_result']; // echo gettype($string); @@ -11960,7 +11961,7 @@ public function getCompaniesListsFromGeneralFormRawJSONV2_post() // echo gettype($my_array); if(!empty($my_array) && !empty($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;$iaws_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 = "face_api_image.jpeg"; @@ -11986,35 +11987,37 @@ public function getCompaniesListsFromGeneralFormRawJSONV2_post() $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile); $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(); 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 $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); $this->PD_Model->saveRecords($record_data,PDDOCUMENTS); unlink($destination_path); } // $data['dataStatus'] = true; // $data['status'] = REST_Controller::HTTP_OK; - // $data['msg'] = 'Given PDID '; + // $data['msg'] = 'Success '; // $data['details'] = $bounding_box; } - // else{ - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NO_CONTENT; - // $data['msg'] = 'Given PDID is Not in Completed Status'; - // } + else{ + log_message('ERROR',"In PD Controller @ line no : 12009 to Make FaceBoundingBox Faceapi Image Already Generated"); + // $data['dataStatus'] = false; + // $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); } diff --git a/api/application/helpers/faceapi_helper.php b/api/application/helpers/faceapi_helper.php index 787fadeb..a2c86b62 100644 --- a/api/application/helpers/faceapi_helper.php +++ b/api/application/helpers/faceapi_helper.php @@ -3,26 +3,26 @@ class faceapi { 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); $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(); - // $img = imagecreatefrompng($destination_path); - if($image_format == 'png'){ - $img = imagecreatefrompng($destination_path); - }else if($image_format == 'jpeg'){ - $img = imagecreatefromjpeg($destination_path); - }else if($image_format == 'jpg'){ - $img = imagecreatefromjpg($destination_path); - } + $img = imagecreatefrompng($destination_path); + // if($image_format == 'png'){ + // $img = imagecreatefrompng($destination_path); + // }else if($image_format == 'jpeg'){ + // $img = imagecreatefromjpeg($destination_path); + // }else if($image_format == 'jpg'){ + // $img = imagecreatefromjpg($destination_path); + // } $red = imagecolorallocate($img, 255, 0, 0); $black = imagecolorallocate($img, 0, 0, 0); $white = imagecolorallocate($img, 255, 255, 255); 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