From 100956bc6fd4767fc1fdbb6723c6d666e83d5fa1 Mon Sep 17 00:00:00 2001 From: Velz2020 Date: Thu, 24 Feb 2022 16:29:50 +0530 Subject: [PATCH] img optimize issue fix 1 --- api/application/config/routes.php | 3 ++- api/application/controllers/PD_Controller.php | 10 ++++++++++ api/application/helpers/myhttpclient_helper.php | 2 +- api/application/models/PD_Model.php | 7 +++++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/api/application/config/routes.php b/api/application/config/routes.php index c2b59bff..75678b13 100755 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -354,4 +354,5 @@ $route['generateOTP'] = 'User_Management_Controller/generateOTP'; $route['verifyOTP'] = 'User_Management_Controller/verifyOTP'; $route['awsrek/(:any)'] = 'Test/testAwsrek'; -$route['optimizeImages/(:num)'] = 'PD_Controller/optimizeImages'; \ No newline at end of file +$route['optimizeImages/(:num)'] = 'PD_Controller/optimizeImages'; +$route['downloadSMCExcelFile/(:num)'] = 'PD_Controller/downloadSMCExcelFile'; \ No newline at end of file diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 21be7471..239940c6 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -11482,6 +11482,16 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() //print_r($result); } + + + public function downloadSMCExcelFile_get() + { + $pd_id = $this->uri->segment(2); + $pd_master_details = $CI->PD_Model->getPDMasterDetails($pdid,$random_string,$pd_master_details); + $bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id']; + $main_applicant_name = $pd_master_details[0]['main_applicant']; + return $singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes'); + } diff --git a/api/application/helpers/myhttpclient_helper.php b/api/application/helpers/myhttpclient_helper.php index 8e7eaf66..f43264b0 100644 --- a/api/application/helpers/myhttpclient_helper.php +++ b/api/application/helpers/myhttpclient_helper.php @@ -32,7 +32,7 @@ class MYHTTPCLIENT //echo IMAGE_OPTIMIZE_LAMBDA_URL;//die(); if(true) { - $reqest_data = ['bucket' => $sourceBucket,'pdid' => $pdid]; + $reqest_data = ['bucket' => $sourceBucket,'pdid' => ('pd' . $pdid)]; //echo json_encode($reqest_data);die(); $client = new \GuzzleHttp\Client(); $response = $client->post( IMAGE_OPTIMIZE_LAMBDA_URL, [ diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index b7c7400b..96f3e157 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -436,6 +436,13 @@ class PD_Model extends SPARQ_Model { //new - all images optimized and stored in single bucket $bucket_name = OPTIMIZED_IMAGE_BUCKET_NAME; + if($api_client == 'customer_app' || $api_client == null)//for customer app or sectionwise getting img api + { + //for sending immediate s3 link to customer app or any front end pointing + //old bucket name + $bucket_name = LENDER_BUCKET_NAME_PREFIX.$lender_id[0]['fk_lender_id']; + } + foreach($document_lists as $key => $value) {