face crop images fixes : ps

This commit is contained in:
VE10-Sanjeev 2022-10-06 20:59:41 +05:30
parent be034c8d74
commit 91785cb4d2
2 changed files with 26 additions and 26 deletions

View File

@ -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);
}
}
}

View File

@ -609,6 +609,7 @@ if ( isset($pdf) ) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <tr><td> --><?php
//print_r($pd_images[18]);
$person_met_data = array();
// print_r($general_form['individuals']);
foreach($general_form['individuals'] as $ind_key => $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 '<img src="'.$person['id_proof'].'" width="300" height="200" alt=""/>';
}
if($person['face_compare'])
{
echo '<img src="'.$person['face_compare'].'" width="300" height="200" alt=""/>';
}
//echo count($person_met_data) != ($pk+1)? '<hr>':'';
}
$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 '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
echo '<img src="'.$faceimage_url[$i].'" width="300" height="200" alt=""/>';
}
}
echo '</div>';
echo '<br>';
@ -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 "<h3>Face Comparison</h3>" ;
$notequal_mark ='<span style="font-family: DejaVu Sans; sans-serif;"><center>≠</center></span>';
$equal_mark ='<span style="font-family: DejaVu Sans; sans-serif;"><center>=</center></span>';
for ($i = 0; $i < count($ci); $i++) {
$symbol = ($similarity > 50) ? '<center><h1>'.$equal_mark.'</h1></center>': '<center><h1>'.$notequal_mark.'</h1></center>';
$similarity = round($ci[$i]["Similarity"]);
$symbol = ($similarity > 50) ? '<center><h1>'.$equal_mark.'</h1></center>': '<center><h1>'.$notequal_mark.'</h1></center>';
if ($similarity > 80) { // above 81 green
$progress_bar_class = 'rcorners_green';
} else if ($similarity <= 80 && $similarity > 60) { // in between 61 to 80 orange