Short Video Link Added : ps

This commit is contained in:
VE10-Sanjeev 2023-02-27 13:19:34 +05:30
parent 6cff15a22b
commit a36551e572
6 changed files with 84 additions and 4 deletions

View File

@ -8792,7 +8792,14 @@ class PD_Controller extends REST_Controller
}
//print_r($final_data);die();
//$final_data[] = array('imag_data' => $common_images,'is_multiple' => 1);
$final_data = array_filter($final_data, function ($var) {
return ($var['content_type'] !== '3');
});
// $filterBy = '3';
// $final_data = array_filter($final_data, function ($var) use ($filterBy) {
// return ($var['content_type'] != $filterBy);
// });
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = array('pd_id' => $pd_id, 'random_string' => $random_string, 'is_cus_link_disabled' => $is_cus_link_disabled, 'img_data' => $final_data);

View File

@ -69,6 +69,10 @@ class Welcome extends CI_Controller {
{
$this->redirect_url = $this->vdo($pd_id,$random_string);
}
else if($type == 'shortvdo')
{
$this->redirect_url = $this->shortvdo($pd_id,$random_string);
}
else if($type == 'ppdf')
{
$this->redirect_url = $this->ppdf($pd_id,$random_string);
@ -115,7 +119,12 @@ class Welcome extends CI_Controller {
}
}
function shortvdo($pd_id,$random_string)
{
// echo "i am Here 124";die();
$this->load->helper('photo_zip_creator');
return $res_data = (new photo_zip_creator)->covertShortVideo2ZIP($pd_id,$random_string,array());
}
function ppdf($pd_id,$random_string)
{
$this->load->helper('photo_pdf_converter');

View File

@ -93,6 +93,68 @@ class photo_zip_creator
}
}
public function covertShortVideo2ZIP($pdid,$random_string,$pd_master_details = array(),$regenerate = 0)
{
$CI =&get_instance();
$CI->load->model('PD_Model');
if(!count($pd_master_details))
{
$pd_master_details = $CI->PD_Model->getPDMasterDetails($pdid,$random_string,$pd_master_details);
}
if(!file_exists($CI->external_path.'/pd_reports/'.$pdid))
{
mkdir($CI->external_path.'/pd_reports/'.$pdid,0777);
}
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id'];
$main_applicant_name = $pd_master_details[0]['main_applicant'];
//get zip url from s3 if any
$key = 'pd'.$pdid.'/'.$main_applicant_name.'_'.$pdid.'_'.'pd_shortvideo.zip';
if($regenerate == 0)
{
$singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
}
else
{
$all_pd_shortvideo = $CI->PD_Model->getSignedPDDocsURL($pdid,null,null,null,null,'report_shortVideo');
//Generate zip file
$CI->load->library('zip');
$CI->zip->add_dir('pdshortvideo');
foreach($all_pd_shortvideo as $image)
{
$temp_dir_name = 'Common';
//replace colon with hyphen in doc name
$doc_name = str_replace(':', '-', $image['pd_document_name']);
$CI->zip->add_data('pdshortvideo/'.$doc_name,file_get_contents($image['doc_url']));
}
$temp_path = $main_applicant_name.'_'.$pdid.'_'.'pd_shortvideo.zip';
$CI->zip->archive($CI->external_path.'/pd_reports/'.$pdid.'/'.$temp_path);
$bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>($CI->external_path.'/pd_reports/'.$pdid.'/'.$temp_path));
$s3result= $CI->aws_s3->uploadFileToS3Bucket($bucket_data);
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
{
unlink($CI->external_path.'/pd_reports/'.$pdid.'/'.$temp_path);
}
$singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
}
return $singed_uri;
}
}
?>

View File

@ -29,7 +29,7 @@ class report_attachments
// $video_uri = (new video_grabber_helper)->grabAllVideo($pd_master_details[0]['pd_id'],$pd_master_details[0]['random_string'],$pd_master_details);
// print_r($video_uri) ;die();
$attachment = '<div id="page_break"></div><h2>Data Links</h2><p><a target="_blank" href="'.PDF_ATTACHEMENT_URL.$uri['ppdf'].'">Click here for Image PDF Link</a></p> <p> <a target="_blank" href="'.PDF_ATTACHEMENT_URL.$uri['zip'].'">Click here for Image ZIP Link</a> </p>';
$attachment = '<div id="page_break"></div><h2>Data Links</h2><p><a target="_blank" href="'.PDF_ATTACHEMENT_URL.$uri['ppdf'].'">Click here for Image PDF Link</a></p> <p> <a target="_blank" href="'.PDF_ATTACHEMENT_URL.$uri['zip'].'">Click here for Image ZIP Link</a> </p><p> <a target="_blank" href="'.PDF_ATTACHEMENT_URL.$uri['shortvdo'].'">Click here for Short Video ZIP Link</a></p>';
if($pd_master_details[0]['fk_pd_type'] == 2 && count($uri['vdo']))// if smart pd
{
$attachment .='<h2>videos</h2>';

View File

@ -37,6 +37,7 @@ class url_shortener
$uri[ 'ppdf' ] = custom_encryption::encode ( 'ppdf/'.$date_of_creation.'/'.$pdid.'/'.$random_string);
$uri[ 'zip' ] = custom_encryption::encode ( 'zip/'.$date_of_creation.'/'.$pdid.'/'.$random_string );
$uri[ 'shortvdo' ] = custom_encryption::encode ( 'shortvdo/'.$date_of_creation.'/'.$pdid.'/'.$random_string );
}
// print_r($uri);die();
return $uri;

View File

@ -428,6 +428,7 @@ class PD_Model extends SPARQ_Model {
$where_condition_array['isactive'] = 1;
}
if($api_client == 'report'){ $where_condition_array['content_type'] = 1; }
if($api_client == 'report_shortVideo'){ $time = '+5 day'; $where_condition_array['isactive'] = 1; $where_condition_array['content_type'] = 2;}
//print_r($where_condition_array);die();
$document_lists = $this->selectRecords(PDDOCUMENTS,$where_condition_array);
@ -441,7 +442,7 @@ 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
if($api_client == 'customer_app' || $api_client == null || $api_client == 'report_shortVideo')//for customer app or sectionwise getting img api
{
//for sending immediate s3 link to customer app or any front end pointing
//old bucket name