UPDATE BASE 64 API
This commit is contained in:
parent
791434eb83
commit
3d274733ce
@ -197,6 +197,7 @@ $route['getAllPersonsName'] = 'PD_Controller/getAllPersonsName';
|
|||||||
$route['getAssetsWithLoanFromBusiness'] = 'PD_Controller/getAssetsWithLoanFromBusiness';
|
$route['getAssetsWithLoanFromBusiness'] = 'PD_Controller/getAssetsWithLoanFromBusiness';
|
||||||
$route['getListOfCities'] = 'PD_Controller/getListOfCities';
|
$route['getListOfCities'] = 'PD_Controller/getListOfCities';
|
||||||
$route['savePDPhotos'] = 'PD_Controller/savePDPhotos';
|
$route['savePDPhotos'] = 'PD_Controller/savePDPhotos';
|
||||||
|
$route['updatePDPhoto'] = 'PD_Controller/updateBase64Images';
|
||||||
$route['getPDAddress'] = 'PD_Controller/getPDAddress';
|
$route['getPDAddress'] = 'PD_Controller/getPDAddress';
|
||||||
$route['updatePDAddress'] = 'PD_Controller/updatePDAddress';
|
$route['updatePDAddress'] = 'PD_Controller/updatePDAddress';
|
||||||
$route['getPDCompleteDetails'] = 'PD_Controller/getPDCompleteDetails';
|
$route['getPDCompleteDetails'] = 'PD_Controller/getPDCompleteDetails';
|
||||||
|
|||||||
@ -6156,7 +6156,7 @@ class PD_Controller extends REST_Controller {
|
|||||||
$tempdoc = $output_file;
|
$tempdoc = $output_file;
|
||||||
$tempdocname = $temp_file_name;
|
$tempdocname = $temp_file_name;
|
||||||
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_details[0]['fk_lender_id'];
|
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_details[0]['fk_lender_id'];
|
||||||
$key = 'pd'.$pd_id.'/'.$tempdocname ;
|
$key = 'pd'.$pd_id.'/'.$tempdocname;
|
||||||
// if($form_id != null)
|
// if($form_id != null)
|
||||||
// {
|
// {
|
||||||
// $key = 'pd'.$pd_id.'/'.'form'.$form_id.'/'.$tempdocname;
|
// $key = 'pd'.$pd_id.'/'.'form'.$form_id.'/'.$tempdocname;
|
||||||
@ -7325,5 +7325,64 @@ class PD_Controller extends REST_Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function updateBase64Images_post()
|
||||||
|
{
|
||||||
|
|
||||||
|
$records = $this->post('records');
|
||||||
|
$pd_details = $this->PD_Model->getPDMasterDetails($records['fk_pd_id']);
|
||||||
|
|
||||||
|
$output_file = APPPATH."/docs/temp_base64_image.png";
|
||||||
|
$temp_file_name = $records['pd_document_name'];
|
||||||
|
|
||||||
|
$ifp = fopen( $output_file, 'wb' );
|
||||||
|
$temp_data = explode( ',', $records['image']);
|
||||||
|
fwrite( $ifp, base64_decode( $temp_data[ 1 ] ) );
|
||||||
|
fclose( $ifp );
|
||||||
|
$tempdoc = $output_file;
|
||||||
|
$tempdocname = $temp_file_name;
|
||||||
|
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_details[0]['fk_lender_id'];
|
||||||
|
$key = 'pd'.$pd_id.'/'.$tempdocname;
|
||||||
|
$sourcefile = $tempdoc;
|
||||||
|
|
||||||
|
$bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile);
|
||||||
|
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
|
||||||
|
|
||||||
|
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
|
||||||
|
{
|
||||||
|
$record_data = array('fk_updatedby' => $records['fk_updatedby']);
|
||||||
|
if(isset($records['is_show_report'])){ $record_data['is_show_report'] = $records['is_show_report']; }
|
||||||
|
if(isset($records['pd_document_title'])){ $record_data['pd_document_title'] = $records['pd_document_title']; }
|
||||||
|
|
||||||
|
$where_condition_array = array('pd_document_id' => $records['pd_document_id']);
|
||||||
|
$id = $this->PD_Model-updateRecords($record_data,PDDOCUMENTS,$where_condition_array);
|
||||||
|
if($id != null || $id != "")
|
||||||
|
{
|
||||||
|
$data['dataStatus'] = true;
|
||||||
|
$data['status'] = REST_Controller::HTTP_OK;
|
||||||
|
$data['records'] = $id;
|
||||||
|
$this->response($data,REST_Controller::HTTP_OK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$data['dataStatus'] = false;
|
||||||
|
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
|
||||||
|
$data['msg'] = 'Something Went Wrong! Try Later';
|
||||||
|
$this->response($data,REST_Controller::HTTP_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$data['dataStatus'] = false;
|
||||||
|
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
|
||||||
|
$data['msg'] = 'Something Went Wrong! Try Later';
|
||||||
|
$this->response($data,REST_Controller::HTTP_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user