SATELLITE IMG TO S3

This commit is contained in:
Velz2020 2019-09-05 19:04:10 +05:30
parent 49053c03d5
commit a5235d9d39
5 changed files with 100 additions and 11 deletions

View File

@ -4676,9 +4676,12 @@ public function getPDFormDetailsJSON_post()
$data['pd_processed_forms'][$i] = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON,array(),'','company_id','ASC');
$fields2 = array('*');
$data['pd_images'][$i] = $this->PD_Model->getSignedPDDocsURL($pdid,$i);
$data['pd_images'][$i] = $this->PD_Model->getSignedPDDocsURL($pdid,$i,null,null,null,'report');
}
//Get Common Images
$data['pd_images']['common_images'] = $this->PD_Model->getSignedPDDocsURL($pdid,null,null,'common',null,'report');
if($data['pd_master_details'][0]['customer_segment_abbr'] == 'SE-RI')
{
$temp = $this->load->view('report_templates/JSONTOREPORT_RI',$data,true);
@ -5501,13 +5504,33 @@ public function getPDFormDetailsJSON_post()
// //convert as base 64 image.
$satellite_image_png_path = $this->external_path.'/pd_reports/'. $pdid .'/satellite.png';
$type = pathinfo($satellite_image_png_path, PATHINFO_EXTENSION);
$satellite_img_content = file_get_contents($satellite_image_png_path);
$base64_pdscore_chart_url = 'data:image/' . $type . ';base64,' . base64_encode($satellite_img_content);
$pd_details = $this->PD_Model->getPDMasterDetails($pdid);
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_details[0]['fk_lender_id'];
$key = 'pd'.$pdid.'/'.'satellite.png';
$bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$this->external_path.'/pd_reports/'.$pdid.'/satellite.png');
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
{
$record_data = array('fk_pd_id' => $pdid,'pd_document_title'=>'satellite','pd_document_name'=>'satellite.png','fk_form_id'=>null,'is_show_report' =>$is_show_report,'rental_count_id' => null,'location' => null);
$id = $this->PD_Model->saveRecords($record_data,PDDOCUMENTS);
$custom_log_info = '###CUSTOM DEBUG SATELLITE IMAGE STORED IN S3 DONE - '. $id;
log_message('ERROR',$custom_log_info);
}
// $type = pathinfo($satellite_image_png_path, PATHINFO_EXTENSION);
// $satellite_img_content = file_get_contents($satellite_image_png_path);
// $base64_pdscore_chart_url = 'data:image/' . $type . ';base64,' . base64_encode($satellite_img_content);
//generate log
$logger->info("Generate Satellite Called in (".ENVIRONMENT.")",array('script' => $satellite_script,'script_output' => $ou));
return $base64_pdscore_chart_url;
//return $base64_pdscore_chart_url;
}
@ -5670,6 +5693,42 @@ public function getPDFormDetailsJSON_post()
{
mkdir($this->external_path.'/pd_reports/'.$pdid,0761);
}
// for($i = 900;$i <= 1500;$i++)
// {
// //echo $this->external_path.'/pd_reports/'.$i;
// if(file_exists($this->external_path.'/pd_reports/'.$i.'/satellite.png'))
// {
// $custom_log_info = '###CUSTOM DEBUG Image Exists - '. $i;
// log_message('ERROR',$custom_log_info);
// $pd_details = $this->PD_Model->getPDMasterDetails($i);
// $bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_details[0]['fk_lender_id'];
// $key = 'pd'.$pd_id.'/'.'satellite.png';
// $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$this->external_path.'/pd_reports/'.$i.'/satellite.png');
// $custom_log_info = '###CUSTOM DEBUG bucket_name - '. $bucketname.' - Key - '.$key;
// log_message('ERROR',$custom_log_info);
// $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
// if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
// {
// $record_data = array('fk_pd_id' => $pd_id,'pd_document_title'=>'satellite','pd_document_name'=>'satellite.png','fk_form_id'=>null,'is_show_report' =>$is_show_report,'rental_count_id' => null,'location' => null);
// $id = $this->PD_Model->saveRecords($record_data,PDDOCUMENTS);
// $custom_log_info = '###CUSTOM DEBUG IMAGE S3 DONE - '. $id;
// log_message('ERROR',$custom_log_info);
// if($id != null || $id != "") { $count++; $pks[] = $id;}
// }
// }
// }
// die();
//$this->external_path.'/pd_reports/'. $pdid .'/satellite.png';
//die();
// $pd_string = 'PD accessed-'.$pdid;
// MYLOG::logFunction(null,$pdid)->info($pd_string,array('data' => 'Test LOg info'));
// MYLOG::logFunction()->warning($pd_string,array('data' => 'Test LOg warn'));
@ -5706,6 +5765,7 @@ public function getPDFormDetailsJSON_post()
$data['pd_master_details'] = $this->PD_Model->getPDMasterDetails($pdid);
$data['applicants_details'] = $this->PD_Model->getApplicantsDetails($pdid);
//print_r($data['pd_master_details']);die();
//$data['satellite_path'] = $this->external_path.'/pd_reports/'. $pdid .'/satellite.png';
$data['lender_disclaimer'] = $this->PD_Model->selectRecords(ENTITYDISCLAIMER,array('fk_entity_id' => $data['pd_master_details'][0]['fk_lender_id']));
$data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid);
@ -5772,7 +5832,7 @@ public function getPDFormDetailsJSON_post()
// print_r($this->db->last_query());
}
//print_r(json_decode($data['pd_processed_forms'][18][0]['processed_json']));die();
$data['pd_images']['common_images'] = $this->PD_Model->getSignedPDDocsURL($pdid,null,null,'common',null,'report');
//print_r($data['pd_images']);die(); //print_r(json_decode($data['pd_processed_forms'][14][0]['processed_json'],true));
//die();
//echo "*******************************************";

View File

@ -288,6 +288,7 @@ class PD_Model extends SPARQ_Model {
if($is_common_api != null)
{
$where_condition_array['company_id'] = null ;
$where_condition_array['fk_form_id'] = null ;
}
@ -298,7 +299,7 @@ class PD_Model extends SPARQ_Model {
}
//print_r($where_condition_array);die();
$document_lists = $this->selectRecords(PDDOCUMENTS,$where_condition_array);
//print_r($this->db->last_query());die();
if(count($document_lists))
{

View File

@ -1 +1 @@
var page = require('webpage').create();page.viewportSize = { width: 600, height: 350 };page.clipRect = { top: 0, left: 0, width: 600, height: 350 };var score = 79;var url = 'http://localhost/AWSEC2/sparqapi/api?'+score;var image_url = 'C:/xampp/htdocs/ssa_external_data/production/pd_reports/23/chart.png' ;page.open(url,function() {setTimeout(function() {page.render(image_url);phantom.exit();}, 500);});
var page = require('webpage').create();page.viewportSize = { width: 600, height: 350 };page.clipRect = { top: 0, left: 0, width: 600, height: 350 };var score = 44.5;var url = 'http://localhost/AWSEC2/sparqapi/api?'+score;var image_url = 'C:/xampp/htdocs/ssa_external_data/production/pd_reports/1/chart.png' ;page.open(url,function() {setTimeout(function() {page.render(image_url);phantom.exit();}, 500);});

View File

@ -984,8 +984,21 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo '<br><br><b> GPS Coordinates of location where PD Visit was done : </b>'.$pd_master_details[0]['start_location'];
echo '<br><br>';
?>
<?php
$satellite_url = '';
if(isset($pd_images['common_images']) && count($pd_images['common_images']))
{
foreach($pd_images['common_images'] as $com_key => $com_value)
{
if($com_value['pd_document_title'] == 'satellite')
{
$satellite_url = $com_value['doc_url'];break;
}
}
}
<img border="3" src = "<?php echo $pd_master_details[0]['satellite_image_base64_blob'];?>" alt=" Satellite Image of location of Where PD was Done" style="width:100%;height:300px;border-color:#0191ed" /><br><br><br>
?>
<img border="3" src = "<?php echo $satellite_url;?>" alt=" Satellite Image of location of Where PD was Done" style="width:100%;height:300px;border-color:#0191ed" /><br><br><br>
<?php if($pd_location_approach_img_url != "" || $name_board_seen_img_url != "") {?>
<table>

View File

@ -808,8 +808,23 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo '<br><br><b> GPS Coordinates of location where PD Visit was done : </b>'.$pd_master_details[0]['start_location'];
echo '<br><br>';
?>
<?php
$satellite_url = '';
if(isset($pd_images['common_images']) && count($pd_images['common_images']))
{
foreach($pd_images['common_images'] as $com_key => $com_value)
{
if($com_value['pd_document_title'] == 'satellite')
{
$satellite_url = $com_value['doc_url'];break;
}
}
}
<img border="3" src = "<?php echo $pd_master_details[0]['satellite_image_base64_blob'];?>" alt=" Satellite Image of location of Where PD was Done" style="width:100%;height:300px;border-color:#0191ed" /><br><br><br>
?>
<img border="3" src = "<?php echo $satellite_url;?>" alt=" Satellite Image of location of Where PD was Done" style="width:100%;height:300px;border-color:#0191ed" /><br><br><br>
<?php if($pd_location_approach_img_url != "" ) {?>
<table>