From 91785cb4d2ba22e65258e9a4ae2d4b16bd3a1047 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Thu, 6 Oct 2022 20:59:41 +0530 Subject: [PATCH] face crop images fixes : ps --- api/application/controllers/PD_Controller.php | 15 +++++--- .../JSONTOREPORT_DI_AI_TELE_PD.php | 37 ++++++++----------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 2c62bf5f..f35047e2 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -10521,9 +10521,9 @@ class PD_Controller extends REST_Controller // public function toMakeFaceBoundingBox_get(){ public function toMakeFaceBoundingBox($pdid,$len_id){ - //$pdid = $this->get('pd'); //comment this bcoz test purpose - //$master_details = $this->PD_Model->getPDMasterDetails($pdid); //comment this bcoz test purpose - //$len_id = $master_details[0]['fk_lender_id']; //comment this bcoz test purpose + // $pdid = $this->get('pd'); //comment this bcoz test purpose + // $master_details = $this->PD_Model->getPDMasterDetails($pdid); //comment this bcoz test purpose + // $len_id = $master_details[0]['fk_lender_id']; //comment this bcoz test purpose log_message('ERROR', "In PD Controller (to Make FaceBoundingBox called ) PDID : " . $pdid); $where = array('isactive' => 1, 'fk_form_id' => 18, 'fk_pd_id' => $pdid); @@ -10654,8 +10654,12 @@ class PD_Controller extends REST_Controller $file = "face_api_image_".$apcntid.$extension; $dbfile = "face_api_image_".$apcntid.".jpeg"; $key = 'pd' . $pdid . '/' . $file; - $sourcefile = $destination_path.$file; - + $image = imagecreatefrompng($destination_path.$file); + $sourcefile = imagejpeg($image, $destination_path.$dbfile, '70'); + // die(); + // imagedestroy($image); + // $sourcefile = $destination_path.$file; + // $sourcefile = imagejpeg($destination_path.$file, $destination_path.$dbfile,'70'); $bucket_data = array('bucket_name' => $bucketname, 'key' => $key, 'sourcefile' => $sourcefile); $s3result = $this->aws_s3->uploadFileToS3Bucket($bucket_data); log_message('ERROR', "In PD Controller to Make FaceBoundingBox FaceMatches s3result : " . $s3result['@metadata']['statusCode']); @@ -10671,6 +10675,7 @@ class PD_Controller extends REST_Controller $record_data = array('fk_pd_id' => $pdid, 'pd_document_title' => 'face_api_result_image_'.$apcntid, 'pd_document_name' => $dbfile ,'co_applicant_id'=>$apcntid,'image_key'=>'face_mark'); $this->PD_Model->saveRecords($record_data, PDDOCUMENTS); unlink($destination_path.$file); + unlink($destination_path.$dbfile); } } } diff --git a/api/application/views/report_templates/JSONTOREPORT_DI_AI_TELE_PD.php b/api/application/views/report_templates/JSONTOREPORT_DI_AI_TELE_PD.php index ebb5eae9..657aa638 100644 --- a/api/application/views/report_templates/JSONTOREPORT_DI_AI_TELE_PD.php +++ b/api/application/views/report_templates/JSONTOREPORT_DI_AI_TELE_PD.php @@ -609,6 +609,7 @@ if ( isset($pdf) ) {               --> $individual) { //print_r($individual);die(); @@ -637,6 +638,16 @@ if ( isset($pdf) ) { $temp_person_met['id_proof'] = $pm_value['doc_url'] ; } } + + + foreach($pd_images['common_images'] as $com_key => $com_value) + { + + if($com_value['image_key'] == 'face_mark' && $com_value['co_applicant_id'] == $individual['pd_co_applicant_id']){ + $temp_person_met['face_compare'] = $com_value['doc_url'] ; + } + } + $company_relationship_data = null; foreach($general_form['company_with_relationships'] as $company_with_relationship) { @@ -708,28 +719,13 @@ if ( isset($pdf) ) { { echo ''; } - + if($person['face_compare']) + { + echo ''; + } //echo count($person_met_data) != ($pk+1)? '
':''; - } - $faceimage_url = array(); - if(isset($pd_images['common_images']) && count($pd_images['common_images'])) - { - foreach($pd_images['common_images'] as $com_key => $com_value) - { - - if($com_value['image_key'] == 'face_mark'){ - // $faceimage_url = $com_value['doc_url'];break; - array_push($faceimage_url,$com_value['doc_url']); - } - } - } - if(!empty($faceimage_url)){ - for ($i = 0; $i < count($faceimage_url); $i++) { - echo '     '; - echo ''; - } } echo ''; echo '
'; @@ -742,14 +738,13 @@ if ( isset($pdf) ) { $fc_arr = $facecrop[$fc]; $ci = !empty($fc_arr[0]['compare_image']) ? $fc_arr[0]['compare_image'] :array() ; $si = !empty($fc_arr[1]['source_image']) ? $fc_arr[1]['source_image'] : array(); - // ########################### Percentage Bar Section ######################################### echo "

Face Comparison

" ; $notequal_mark ='
'; $equal_mark ='
=
'; for ($i = 0; $i < count($ci); $i++) { - $symbol = ($similarity > 50) ? '

'.$equal_mark.'

': '

'.$notequal_mark.'

'; $similarity = round($ci[$i]["Similarity"]); + $symbol = ($similarity > 50) ? '

'.$equal_mark.'

': '

'.$notequal_mark.'

'; if ($similarity > 80) { // above 81 green $progress_bar_class = 'rcorners_green'; } else if ($similarity <= 80 && $similarity > 60) { // in between 61 to 80 orange