FlyHI Photograph : ps

This commit is contained in:
VE10-Sanjeev 2022-06-17 11:28:05 +05:30
parent 830589b612
commit 455cfca658
3 changed files with 319 additions and 40 deletions

View File

@ -386,5 +386,7 @@ $route['getFlyhiCreditPersonList'] = 'Flyhi_Controller/lenderCreditPersonForFlyh
$route['getFlyhiBranchList'] = 'Flyhi_Controller/branchMasterForFlyhiPD';
$route['getFlyhiProductList'] = 'Flyhi_Controller/productMasterForFlyhiPD';
$route['getFlyhiLenderList'] = 'Flyhi_Controller/lenderMasterForFlyhiPD';
$route['saveFlyhiPDImage'] = 'Flyhi_Controller/saveFlyhiPDImage';
$route['getFlyhiPDImgDataCusLink']='Flyhi_Controller/getFlyhiPDImgDataCusLink';

View File

@ -263,8 +263,8 @@ class Flyhi_Controller extends REST_Controller {
log_message('ERROR','####FLYHI-PD SAVE CALLED');
// $section_names = array('1' => 'General Section','2' => 'Photography');
$section_names = array('1' => 'General Section');
$section_names = array('1' => 'General Section','2' => 'Photography');
// $section_names = array('1' => 'General Section');
if($records['sales_pd_id'] == '' || $records['sales_pd_id'] == null)
{
@ -324,11 +324,11 @@ class Flyhi_Controller extends REST_Controller {
{
if($g_value['answer_value'] == 'Residence verification' && $j_value['question_key'] == 'residence_city'){
$city = $j_value['answer_value'];
$sales_pd_type = 4;
$flyhi_pd_type = 4;
}
if($g_value['answer_value'] == 'Office verification' && $j_value['question_key'] == 'officer_city'){
$city = $j_value['answer_value'];
$sales_pd_type = 3;
$flyhi_pd_type = 3;
}
if($g_value['answer_value'] == 'Office verification' && $j_value['question_key'] == 'employer_business_name')
{
@ -357,7 +357,7 @@ class Flyhi_Controller extends REST_Controller {
$FLYHI_PD['lender_id'] = $lender_id;
$FLYHI_PD['createdby'] = $fk_createdby;
$FLYHI_PD['rand_string'] = $randomString;
$FLYHI_PD['sales_pd_type'] = $sales_pd_type;
$FLYHI_PD['sales_pd_type'] = $flyhi_pd_type;
$FLYHI_PD['product_id'] = $product_id ? $product_id : (ENVIRONMENT == 'production' ? 27 : 26);
$flyhi_pd_id = $this->Flyhi_Model->saveRecords($FLYHI_PD,SALES_PD_DATA);
$section_data = json_encode($records);
@ -372,14 +372,54 @@ class Flyhi_Controller extends REST_Controller {
if(isset($records['status']) && $records['status'] == 'COMPLETED')
{
log_message('ERROR','####COMPLETE FLYHI-PD'.$records['sales_pd_id']);
$records['status'] = 'COMPLETED';
$records['is_cus_link_disabled'] = 1;
$records['completed_date'] = date('Y-m-d H:i:s');
$flyhi_pd_id = $this->Flyhi_Model->updateRecords($records,SALES_PD_DATA,array('sales_pd_id' => $records['sales_pd_id']));
$drafted_sections = $this->Flyhi_Model->selectCustomRecords(array('section_id'),array('status' => 0,'sales_pd_id' => $records['sales_pd_id'],'isactive' => 1),SALESPD_SECTION_DATA);
$completed_sections = $this->Flyhi_Model->selectCustomRecords(array('section_id'),array('status' => 1,'sales_pd_id' => $records['sales_pd_id'],'isactive' => 1),SALESPD_SECTION_DATA);
$this->prepareFlyhiPDReport($records['sales_pd_id'],false);
sleep(10);
log_message('ERROR','####FLYHI-PD AFTER 10 PREPARED REPORT'.$records['sales_pd_id']);
$dup_of_section_names = $section_names;
foreach ($completed_sections as $completed_section_key => $completed_section_value)
{
if($dup_of_section_names [ $completed_section_value['section_id'] ] )
{
unset($dup_of_section_names [ $completed_section_value['section_id'] ]);
}
}
unset($dup_of_section_names[2]);//unset photograph always
$img_satellite_check = $this->Flyhi_Model->selectCustomRecords(array('count(*) as count'),array('img_name' => 'satellite','fk_sales_pd_id' => $records['sales_pd_id'],'isactive' => 1),SALEPD_DOCS);
$img_selfile_check = $this->Flyhi_Model->selectCustomRecords(array('count(*) as count'),array('img_name' => 'selfie_with_person_met','fk_sales_pd_id' => $records['sales_pd_id'],'isactive' => 1),SALEPD_DOCS);
if(count($drafted_sections) )
{
$drafted_sections = array_map(function($single) use ($section_names)
{
return array('section_id' => $single['section_id'],'sectin_name' => $section_names [ $single['section_id'] ]);
},$drafted_sections);
unset($records['status']);
$data['dataStatus'] = true;
$data['records'] = $drafted_sections;
$data['pd_status'] = 'DRAFT';
$data['status'] = REST_Controller::HTTP_OK;
$this->response($data,REST_Controller::HTTP_OK);
}
else if($img_satellite_check[0]['count'] == 0 || $img_selfile_check[0]['count'] == 0)
{
unset($records['status']);
$data['dataStatus'] = true;
$data['records'][] = ($img_selfile_check[0]['count'] == 0) ? array('section_id' => 2,'section_name' => 'selfie image') : ( $img_satellite_check[0]['count'] == 0 ? array('section_id' => 2,'section_name' => 'satellite image') :('selfie image and satellite image ar not available'));
$data['pd_status'] = 'DRAFT';
$data['status'] = REST_Controller::HTTP_OK;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$records['status'] = 'COMPLETED';
$records['is_cus_link_disabled'] = 1;
$records['completed_date'] = date('Y-m-d H:i:s');
$flyhi_pd_id = $this->Flyhi_Model->updateRecords($records,SALES_PD_DATA,array('sales_pd_id' => $records['sales_pd_id']));
$this->prepareFlyhiPDReport($records['sales_pd_id'],false);
sleep(10);
log_message('ERROR','####FLYHI-PD AFTER 10 PREPARED REPORT'.$records['sales_pd_id']);
}
}
else
{
@ -437,11 +477,11 @@ class Flyhi_Controller extends REST_Controller {
{
if($g_value['answer_value'] == 'Residence verification' && $j_value['question_key'] == 'residence_city'){
$city = $j_value['answer_value'];
$sales_pd_type = 4;
$flyhi_pd_type = 4;
}
if($g_value['answer_value'] == 'Office verification' && $j_value['question_key'] == 'officer_city'){
$city = $j_value['answer_value'];
$sales_pd_type = 3;
$flyhi_pd_type = 3;
}
if($g_value['answer_value'] == 'Office verification' && $j_value['question_key'] == 'employer_business_name')
{
@ -493,10 +533,54 @@ class Flyhi_Controller extends REST_Controller {
public function getFlyhiPD_get()
{
$Flyhi_pdid = $this->get('pd_id');
$section_id = $this->get('section_id');
$section_data = array();
if(isset($Flyhi_pdid) || $Flyhi_pdid != "" || $Flyhi_pdid != null)
{
$section_data = $this->Flyhi_Model->selectCustomRecords(array('*'),array('sales_pd_id' => $Flyhi_pdid,'isactive' => 1,'section_id' => 1),SALESPD_SECTION_DATA);
if(isset($section_id) || $section_id != "" || $section_id != null){
$section_data = $this->Flyhi_Model->selectCustomRecords(array('*'),array('sales_pd_id' => $Flyhi_pdid,'isactive' => 1,'section_id' => $section_id),SALESPD_SECTION_DATA);
if($section_id == 2 && count($section_data))
{
$all_sales_pd_images = $this->Flyhi_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $records['sales_pd_id'],'img_name !=' => 'satellite','isactive' => 1),SALEPD_DOCS);
$photo_questions = (json_decode(($section_data[0]['section_data']),true));
foreach ($photo_questions['questions'] as $key => $value)
{
if(isset($value['answer_value']) && $value['answer_value'] && !$value['is_repeatable'])
{
$selfie = $this->Flyhi_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $records['sales_pd_id'],'img_name' => 'selfie_with_person_met','isactive' => 1),SALEPD_DOCS);
if(count($selfie))
{
$photo_questions['questions'][$key]['answer_value'] = $selfie[0]['img'];
}
}
else
{
foreach ($value['questions_group'] as $v_key => $individual_value)
{
if(isset($individual_value['questions'][0]['answer_value']))
{
foreach ($all_sales_pd_images as $img_key => $img_value)
{
if($individual_value['questions'][0]['question_key'] == $img_value['img_name'])
{
$photo_questions['questions'][$key]['questions_group'][$v_key]['questions'][0]['answer_value'] = $img_value['img'];
unset($all_sales_pd_images[$img_key]);
break;
}
}
}
}
}
}
$photo_questions = json_encode($photo_questions);
$section_data[0]['section_data'] = $photo_questions;
}
}else{
$section_data = $this->Flyhi_Model->selectCustomRecords(array('*'),array('sales_pd_id' => $Flyhi_pdid,'isactive' => 1),SALESPD_SECTION_DATA);
}
}
if($section_data)
{
@ -519,12 +603,12 @@ class Flyhi_Controller extends REST_Controller {
$records = $this->post('records');
$lender_id = $records['lender_id'];
// $product = $records['product_id'];
$sales_pd_type = $records['sales_pd_type'] ? $records['sales_pd_type'] : null;
$flyhi_pd_type = $records['sales_pd_type'] ? $records['sales_pd_type'] : null;
$product = $records['product_id'];
$pd_type = 2;
if(isset($records['pd_type'])){ $pd_type = $records['pd_type'];}
$template = $this->Flyhi_Model->selectCustomRecords(array('*'),array('lender_id' => $lender_id,'pd_type' => $pd_type,'sales_pd_type' => $sales_pd_type,'isactive' => 1),SALESPDTEMPLATE);
// $template = $this->Flyhi_Model->selectCustomRecords(array('*'),array('lender_id' => $lender_id,'product_id' => $product,'pd_type' => $pd_type,'sales_pd_type' => $sales_pd_type,'isactive' => 1),SALESPDTEMPLATE);
$template = $this->Flyhi_Model->selectCustomRecords(array('*'),array('lender_id' => $lender_id,'pd_type' => $pd_type,'sales_pd_type' => $flyhi_pd_type,'isactive' => 1),SALESPDTEMPLATE);
// $template = $this->Flyhi_Model->selectCustomRecords(array('*'),array('lender_id' => $lender_id,'product_id' => $product,'pd_type' => $pd_type,'sales_pd_type' => $flyhi_pd_type,'isactive' => 1),SALESPDTEMPLATE);
if(is_array($template) && count($template))
{
$data['dataStatus'] = true;
@ -567,20 +651,20 @@ class Flyhi_Controller extends REST_Controller {
);
$where_condition_array = array('SALES_PD_DATA.sales_pd_id' => $pd_id);
// $where_condition_array = array('SALES_PD_DATA.sales_pd_id' => $sales_pd_id);
$sales_pd_data = $this->Flyhi_Model->getJoinRecords($columns,$table,$joins,$where_condition_array);
// $where_condition_array = array('SALES_PD_DATA.sales_pd_id' => $flyhipd_id);
$flyhipd_data = $this->Flyhi_Model->getJoinRecords($columns,$table,$joins,$where_condition_array);
$pd_type = "";
if($sales_pd_data[0]['sales_pd_type'] == 3){$pd_type = "Office FI PD-"; }else if($sales_pd_data[0]['sales_pd_type'] == 4){$pd_type = "Residence FI PD-";}
if($flyhipd_data[0]['sales_pd_type'] == 3){$pd_type = "Office FI PD-"; }else if($flyhipd_data[0]['sales_pd_type'] == 4){$pd_type = "Residence FI PD-";}
if($sales_pd_data)
if($flyhipd_data)
{
ini_set('max_execution_time', 0);
$bucket_name = LENDER_BUCKET_NAME_PREFIX.$sales_pd_data[0]['lender_id'];
$bucket_name = LENDER_BUCKET_NAME_PREFIX.$flyhipd_data[0]['lender_id'];
// 1st Type Key name. (name,abbr and date).
$pdf_name = strtolower(trim($sales_pd_data[0]['applicant_name']));
$pdf_name = strtolower(trim($flyhipd_data[0]['applicant_name']));
// $pdf_name .= '-'.$pd_type;
$pdf_name .= '-'.$pd_type.$sales_pd_data[0]['abbr'];
$pdf_name .= '-'.(date('dmY',strtotime($sales_pd_data[0]['completed_date'])));
$pdf_name .= '-'.$pd_type.$flyhipd_data[0]['abbr'];
$pdf_name .= '-'.(date('dmY',strtotime($flyhipd_data[0]['completed_date'])));
$key = 'sales_pd/'.$pd_id.'/'.$pdf_name.'.pdf';
//$this->Flyhi_Model->updateRecords(array('pd_report_filename' => 'PD_Report-'.$pdf_name),SALES_PD_DATA,array('sales_pd_id' => $pd_id));
@ -589,27 +673,30 @@ class Flyhi_Controller extends REST_Controller {
mkdir($this->external_path.'/sales_pd/'.$pd_id,0777);
}
if(!$sales_pd_data[0]['is_pdf'] || $sales_pd_data[0]['is_edited'])
if(!$flyhipd_data[0]['is_pdf'] || $flyhipd_data[0]['is_edited'])
{
$all_section_data = $this->Flyhi_Model->selectCustomRecords(array('*'),array('sales_pd_id' => $pd_id,'isactive' => 1),SALESPD_SECTION_DATA,array(),'','section_id','ASC');
// print_r(json_decode($all_section_data[0]['section_data'],true));die();
$view_data['master'] = $sales_pd_data;
$common_fields = array('pdid'=>$sales_pd_data[0]['sales_pd_id'],
// 'product'=>$sales_pd_data[0]['abbr'],
'caseno'=>$sales_pd_data[0]['sales_pd_sno']);
$view_data['master'] = $flyhipd_data;
$common_fields = array('pdid'=>$flyhipd_data[0]['sales_pd_id'],
// 'product'=>$flyhipd_data[0]['abbr'],
'caseno'=>$flyhipd_data[0]['sales_pd_sno']);
foreach ($all_section_data as $sec_key => $section)
{
// print_r($section['section_id']);die();
// log_message('ERROR','####PREPARE SALESPD REPORT CALLED'.$pd_id);
$view_data['section'.$section['section_id'] ] = $this->processSalesPDJSON($section);//die();
$section_fields['section'.$section['section_id'] ] = $this->processSalesPDJSON($section);
$view_data['section'.$section['section_id'] ] = $this->processFlyhiPDJSON($section);//die();
$section_fields['section'.$section['section_id'] ] = $this->processFlyhiPDJSON($section);
}
$view_data['geo_location'] = $sales_pd_data[0]['geo_location'];
$view_data['section2'] = $this->Flyhi_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $pd_id,'img_name !=' => 'satellite','isactive' => 1),SALEPD_DOCS);
$view_data['product_id'] = $flyhipd_data[0]['product_id'];
$view_data['geo_location'] = $flyhipd_data[0]['geo_location'];
$view_data['satellite_image'] = $this->Flyhi_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $pd_id,'img_name' => 'satellite','isactive' => 1),SALEPD_DOCS);
// die();
//$view_name = $sales_pd_data[0]['short_name'].'_'.$sales_pd_data[0]['abbr'];
$view_name = $sales_pd_data[0]['short_name'];
//$view_name = $flyhipd_data[0]['short_name'].'_'.$flyhipd_data[0]['abbr'];
$view_name = $flyhipd_data[0]['short_name'];
$html_content = $this->load->view('sale_pd_templates/'.$view_name,$view_data,true);
// echo $html_content;die();
$pdf_doc = $this->pdfgenerator->generate($html_content, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait");
@ -668,16 +755,16 @@ class Flyhi_Controller extends REST_Controller {
}
}
function processSalesPDJSON($section_array)
function processFlyhiPDJSON($section_array)
{
if($section_array['section_id'])
{
$questions = json_decode($section_array['section_data'],true);
return $this->processSalesPDQuestions($questions['questions'],$section_array['section_id']);
return $this->processFlyhiPDQuestions($questions['questions'],$section_array['section_id']);
}
}
function processSalesPDQuestions($questions,$section_id)
function processFlyhiPDQuestions($questions,$section_id)
{
$temp_array = array();
foreach ($questions as $ques_key => $question)
@ -709,7 +796,7 @@ class Flyhi_Controller extends REST_Controller {
$onchange_array = $question['onchange_properties'][$a]['form_controls'];
$singleArray = [];
for ($i = 0; $i < count($onchange_array); $i++){
$value = $this->processSalesPDQuestions($onchange_array[$i]['questions'],$section_id);
$value = $this->processFlyhiPDQuestions($onchange_array[$i]['questions'],$section_id);
foreach ($value as $key => $val){ $temp_array[$key] = $val; }
}
}
@ -807,4 +894,151 @@ class Flyhi_Controller extends REST_Controller {
}
}
public function saveFlyhiPDImage_post()
{
$records = $this->post('records');
$is_customer_app = isset($records['is_customer_app']) ? $records['is_customer_app'] : null;
unset($records['is_customer_app']);
if($records['img_name'] == 'selfie_with_person_met')
{
$update_fields2 = array('isactive' => 0);
$this->Flyhi_Model->updateRecords($update_fields2,SALEPD_DOCS,array('img_name' => 'selfie_with_person_met','fk_sales_pd_id' => $records['fk_sales_pd_id']));
if($is_customer_app)
{
$this->Flyhi_Model->updateRecords(array('isactive' => 0),SALESPD_SECTION_DATA,array('section_id' => 2,'sales_pd_id' => $records['fk_sales_pd_id']));
}
}
$id = $this->Flyhi_Model->saveRecords($records,SALEPD_DOCS);
if($id)
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = "Image Updated at ".$id;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$data['msg'] = 'Something went wrong! Try Later';
$this->response($data,REST_Controller::HTTP_OK);
}
}
public function getFlyhiPDImgDataCusLink_post()
{
$rand_string = $this->post('rand_string');
$sales_pd_master_data = $this->Flyhi_Model->selectCustomRecords(array('*'),array('rand_string' => $rand_string),SALES_PD_DATA);
$product_short_name = $this->Flyhi_Model->selectCustomRecords(array('abbr'),array('product_id' => $sales_pd_master_data[0]['product_id']),PRODUCTS);
$sales_pd_img_data = $this->Flyhi_Model->selectCustomRecords(array('doc_id', 'fk_sales_pd_id','img','img_name','isactive'),array('fk_sales_pd_id' => $sales_pd_master_data[0]['sales_pd_id'],'isactive' => 1,'img_name!=' => 'satellite'),SALEPD_DOCS);
// print_r($product_short_name);die();
//sales tele pd img structure array
$imgs = array('selfie_with_person_met' => array('is_multiple' => 0,'img_name' => 'Selfie of the person contacted'));
$img_data = array();
if(count($sales_pd_img_data))
{
foreach ($imgs as $key => $value)
{
//echo "FISRT LOOP****$key";
foreach ($sales_pd_img_data as $sales_pd_img_data_key => $sales_pd_img_data_value)
{
//echo "SEC LOOP****";
if($key == $sales_pd_img_data_value['img_name'])
{
if($value['is_multiple'])
{
if(!array_key_exists($key,$img_data))
{
$img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_data' => [array('img_url' => $sales_pd_img_data_value['img'] ? $sales_pd_img_data_value['img'] : '')],'is_multiple' => 1,'section_heading' => $value['img_name']);
}
else
{
$img_data[$key]['img_data'][] = array('img_url' => $sales_pd_img_data_value['img'] ? $sales_pd_img_data_value['img'] : '');
}
}
else
{
$img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_url' => $sales_pd_img_data_value['img'] ? $sales_pd_img_data_value['img'] : '','is_multiple' => 0,'section_heading' => $value['img_name']);//$sales_pd_img_data_value['img']
}
unset($sales_pd_img_data[$sales_pd_img_data_key]);
//break;
}
// else
// {
// if(!$value['is_multiple'])
// {
// $img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_url' => $value['is_multiple'] == 0 ? '' : array(),'is_multiple' => $value['is_multiple'],'section_heading' => $value['img_name']);
// }
// else
// {
// if(!array_key_exists($key,$img_data))
// {
// $img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_data' => [array('img_url' => $sales_pd_img_data_value['img'] ? 'Y' : 'N')],'is_multiple' => 1,'section_heading' => $value['img_name']);
// }
// else
// {
// $img_data[$key]['img_data'][] = array('img_url' => $sales_pd_img_data_value['img'] ? 'yes' : 'No');
// }
// }
// }
}
//IF current img key is not exist in existing img arry
if(!array_key_exists($key,$img_data))
{
if(!$value['is_multiple'])
{
$img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_url' => '','is_multiple' => $value['is_multiple'],'section_heading' => $value['img_name']);
}
else
{
$img_data[$key] = array('img_key' => $key,'img_name' => $value['img_name'],'img_data' => array(),'is_multiple' => $value['is_multiple'],'section_heading' => $value['img_name']);
}
}
}
$img_data = array_values($img_data);
}
else
{
foreach ($imgs as $key => $value)
{
if($value['is_multiple'])
{
$img_data[] = array('img_key' => $key,'img_name' => $value['img_name'],'img_data' => array(),'is_multiple' => 1,'section_heading' => $value['img_name']);
}
else
{
$img_data[] = array('img_key' => $key,'img_name' => $value['img_name'],'img_url' => '','is_multiple' => 0,'section_heading' => $value['img_name']);
}
}
}
//print_r($img_data);
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = array('sales_pd_id' => $sales_pd_master_data[0]['sales_pd_id'],'img_data' => $img_data,'is_cus_link_disabled' => $sales_pd_master_data[0]['is_cus_link_disabled']);
$this->response($data,REST_Controller::HTTP_OK);
}
}// Class Ends

View File

@ -367,5 +367,48 @@ defined('BASEPATH') OR exit('No direct script access allowed');
</tr> -->
</tbody>
</table>
<div id="page_break"></div>
<br><table class="scorecard_table"><tr><th class="thlargefont" colspan="10">Satellite Image of PD Location</th></tr></table><br>
<p><b>GPS Coordinates of location where PD Visit was done : <?php echo $geo_location ? $geo_location : '-'; ?></b></p>
<?php if($geo_location) { ?>
<img style="border:3px solid #0191ed;" src = "<?php echo 'data:image/gif;base64,'.$satellite_image[0]['img']; ?>" alt = "PD Visted Location Satellite Image " height="300px" width="630px">
<?php
}else{ echo '<p>Due to location access not provided by loan applicant Geo coordinates on photographs and Satellite image of PD location is not shown</p>';}
?>
<?php
$iter = 0;
$photo_names = array('selfie_with_person_met' => 'Selfie with person met','satellite1' => 'satellite');
$tot_rows = ceil(count($section2) / 3);
if(count($section2))
{
echo '<div id="page_break"></div>';
echo '<table class="scorecard_table"><tr><th class="thlargefont" colspan="10">Photograph`s</th></tr></table><br><table ><tbody>';
$add_factor = 0;
for($row = 0;$row < $tot_rows; $row++)
{
echo '<tr>';
$from = $row == 0 ? $row : ($row+$add_factor);
$to = ($from + 2);
$add_factor = $add_factor + 2;
for($i = $from ; $i <= $to; $i++)
{
if(isset($section2[$i]))
{
echo '<td style="text-align:center;border:1px solid;"> <img src="'.$section2[$i]['img'].'" height = "200" width="200" alt="'.$section2[$i]['img_name'].'"/><br>'.$photo_names [ $section2[$i]['img_name'] ].'</td>';
}
//unset($p_key);
}
echo '</tr>';
}
echo '</tbody></table>';
}
?>
</body>
</html>