0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 13.58.77.244


Current Path : /proc/thread-self/root/var/www/html/sikkim/Report_details/
Upload File :
Current File : //proc/thread-self/root/var/www/html/sikkim/Report_details/photo_report.php

<?php

require_once("/var/www/html/aws/aws-autoloader.php");
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
ini_set("memory_limit",-1);
ini_set('max_execution_time',3300);

function generateAllStudentPhotosreport($aobj_context)
{	
	session_start();
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
    $college_code = $_SESSION['collcode'];
	$FUNIVCODE = $_SESSION['FUNIVCODE'];
	
	$college_from = trim($aobj_context->mobj_data["college_from"]);
	$college_to = trim($aobj_context->mobj_data["college_to"]);
	
	$degree_from = trim($aobj_context->mobj_data["degree_from"]);
//	var_dump($degree_from );
	$degree_to = trim($aobj_context->mobj_data["degree_to"]);
	$regto = trim($aobj_context->mobj_data["regto"]);
	$regfrom = trim($aobj_context->mobj_data["regfrom"]);
	

	$type = trim($aobj_context->mobj_data["type"]);
	
	
	
	$main_src_obj=(explode("/",$_SERVER["REQUEST_URI"]));
	$main_src=$main_src_obj[1];
	//$pdf_writer_class=$aobj_context->main_src."/tcpdf/fpdf.php";	
	$pdf_writer_class =$aobj_context->main_src."/tcpdf/tcpdf.php";
	$root_pdf_file_download=$aobj_context->main_src."/Report_details/output/report_general_list.pdf";
	$getnumword=$aobj_context->main_src."/src/getnumword.php";
	include($getnumword);
	//$pdf->WhichReport = 'AdmissionTicket';
	// global varibales
	$p_count =1;
	// end global varibales
	//echo getnumber_to_word("001"); die();
	include($pdf_writer_class);		
	$pdf= new TCPDF();
	
	$pdf->SetFont('Times','',10);
	$pdf->SetMargins(20,13);		
	//$pdf->AliasNbPages();	

	// query for the page header	
	$page_header_university = "select FUNIVNAME,FTOWN, date_format(now(),'%d/%m/%Y') as date,funivcode from control";
	$lobj_page_header_university = $aobj_context->mobj_db->GetRow($page_header_university);

	$pdf->aobj_context =$aobj_context ;
	//$pdf->WhichReport = 'MARKS_SUBJECTWISE';
	$UNIVNAME = $lobj_page_header_university['FUNIVNAME'];
	$pdf->FTOWN = $lobj_page_header_university['FTOWN'];
	$FUNIVCODE = $lobj_page_header_university['funivcode'];
			
/* 	$query = "select fdegree,fregno,fname,fcaste,fsex,fphotopath,concat(fregno,'.jpg')as fhphotopath from student 
			  where fdegree between '{$degree_from}' and '{$degree_to}' and 
			  fcollcode between '{$college_from}' and '{$college_to}' and ifnull(fdeleted,'') <> 'T' order by fdegree,fregno,fcollcode";
		   */
		$query = "  select distinct fcollcode,CONCAT(student.fdegree,' - ',FDESCPN) as fdegree,fregno,fname,fcaste,fgender as fsex,fphotopath from student,degree 
where student.fdegree between '{$degree_from}' and '{$degree_to}' and student.`FDEGREE` =  degree.`FDEGREE` and 
fcollcode between '{$college_from}' and '{$college_to}' 
and  student.fregno between '{$regfrom}' and '{$regto}' 
order by fdegree,fregno,fcollcode";
	// var_dump($query);
	//   die();
	$lobj_get_subject_data = $aobj_context->mobj_db->GetAll($query);
	
	$get_date_time="SELECT DATE_FORMAT(now(),'%d-%b-%Y %H:%m %r') as dt";
	$ob_dt = $aobj_context->mobj_db->GetRow($get_date_time); 
	$date_timef=$ob_dt['dt'];
	
	$first=true;
	$sl_no=1;
	$k=0;
	$n=0;
	$pdf->SetFont('Times','',10);
	$olddeg ="";
	$newdeg ="";
	$fbatchold  = "";
		
	//$pdf->Rect(5,09,200,280);
	$j = 1;
	if($FUNIVCODE == '018')
	{
		$pdf->AddPage();
		$pdf->SetMargins(20,13);
		$pdf->SetFont('Times','B',10);

		$pdf->Cell(175,5,$UNIVNAME,'0',1,'C');
		$pdf->Cell(175,5,'Student Photo List','0',1,'C');
	}
	$i = 0;
	foreach($lobj_get_subject_data as $key => $value)
	{	

		if($FUNIVCODE == '018')
		{

			
			
			$x = $pdf->GetX();
			$y = $pdf->GetY();
			
			$full_photo_path="https://university-student-photos.s3.ap-south-1.amazonaws.com/".$FUNIVCODE."/".$value['fphotopath'];
		//$image = var_dump($full_photo_path);
			$image = file_get_contents($full_photo_path);
			$size = getimagesize($full_photo_path);
			
			if(!empty($value['fphotopath']))
			{
				
				//$pdf->setY($pdf->GetY()+2);
				if($i ==5)
				{	
					$pdf->Cell(30,6,$value['fcollcode'].' - '.$value['fregno'],'1',1,'C');			
					$pdf->Image('@'.$image,$x,$y+8,25,25);
					$pdf->SetY($y+38);
					$i=0;
				}	
				else
				{	
					$pdf->Cell(30,6,$value['fcollcode'].' - '.$value['fregno'],'1',0,'C');	
					$pdf->Image('@'.$image,$x,$y+8,25,25);
				}
			}
			else
			{
				$pdf->Image($aobj_context->main_src."/img/nophotoborder.jpg",$x,$y+8,25,25);	
				$pdf->Cell(30,6,$value['fcollcode'].' - '.$value['fregno'],'1',1,'C');			
			}
		
			
			$i++;
			
		}else
		{
		
			$newdeg = $value['fdegree'];
			if($newdeg != $olddeg)
			{	$pdf->AddPage();
				$pdf->SetMargins(20,13);
				$pdf->SetFont('Times','B',10);
				
				$pdf->Cell(175,5,$UNIVNAME,'0',1,'C');
				$pdf->Cell(175,5,'Student Photo List','0',1,'C');
				$pdf->Cell(175,5,'Degree : '.$newdeg,'0',1,'C');
				$olddeg = $newdeg;
				$j=1;
			}	
			$fbatchnew = $value['fbatch'];
			if($pdf->GetY() > 260)
			{
				$pdf->AddPage();
				//$pdf->SetMargins(20,15);
				$pdf->Cell(175,5,'Student Photo List','0',1,'C');
				$pdf->Cell(175,5,$newdeg,'0',1,'C');
				$pdf->SetFont('Times','B',10);
				$pdf->Cell(10,7,'Sl. No.','1',0,'C');
				$pdf->Cell(30,7,'Register No.','1',0,'C');
				$pdf->Cell(55,7,'Name','1',0,'C');
				$pdf->Cell(20,7,'Caste','1',0,'C');
				$pdf->Cell(20,7,'Gender','1',0,'C');
				$pdf->Cell(35,7,'Photo','1',1,'C');
				//$pdf->SetMargins(28.35,17);	
				//$pdf->Rect(5,09,200,280);
			}
			if($first)
			{
				$pdf->SetFont('Times','B',10);
				$pdf->Cell(10,7,'Sl. No.','1',0,'c');
				$pdf->Cell(30,7,'Register No.','1',0,'c');
				$pdf->Cell(55,7,'Name','1',0,'c');
				$pdf->Cell(20,7,'Caste','1',0,'C');
				$pdf->Cell(20,7,'Gender','1',0,'C');
				$pdf->Cell(35,7,'Photo','1',1,'C');
				$first = false;
			}
			$pdf->SetFont('Times','',10);
			$i = 33;
			$x = $pdf->GetX();
			$y = $pdf->GetY();
			$pdf->Cell(10,30,$j,'1',0,'C');
			$pdf->Cell(30,30,$value['fregno'],'1',0,'C');
			$pdf->Cell(55,30,$value['fname'],'1',0,'L');
			$pdf->Cell(20,30,$value['fcaste'],'1',0,'L');
			$pdf->Cell(20,30,$value['fsex'],'1',0,'L');
			$pdf->Cell(35,30,'','1',1,'L');
			
			$keyname = $FUNIVCODE."/".$value['fphotopath'];
			//var_dump($keyname);
			
				$s3 = S3Client::factory(
					array(
						'credentials' => array(
							'key' => IAM_KEY,
							'secret' => IAM_SECRET
						),
						'version' => "latest",
						'region'  => 'ap-south-1'
					)
				);
			$filePath = tempnam(sys_get_temp_dir(), rand(10,15));
			try{
			$result = $s3->getObject([
				'Bucket' => STUDENT_PHOTOS_BUCKET,
				'Key'    => $keyname,
				'SaveAs' => $filePath
			]);}
			catch(S3Exception $e){
			}
			
				
			$full_photo_path = $filePath;

			$full_photo_path="https://university-student-photos.s3.ap-south-1.amazonaws.com/".$FUNIVCODE."/".$value['fphotopath'];
			//$image = var_dump($full_photo_path);
			$image = file_get_contents($full_photo_path);
			$size = getimagesize($full_photo_path);
			// var_dump($size);
			// die();
			//echo $value['fregno']," - ",$size['channels']."<br>";

			if(!empty($value['fphotopath']))
			{
				$pdf->Image('@'.$image,160,$y+2,25,25);				
			}
			else
			{
				$pdf->Image($aobj_context->main_src."/img/nophotoborder.jpg",160,$y+2,25,25);				
			}
			
			$j++;
			$i= $i+10;
		}
	}
	$pdf->Ln(5);

	$pdf->Output("report_top_sheet.pdf","I");
	
}
?>