<?
function jpgimage($filename,$upload_file1,$upload_file2,$upload_file3,$upload_file4,$upload_file5,$upload_file6)
{
	// Content type
header('Content-type: image/jpeg');

// Get new dimensions
list($width, $height) = getimagesize($filename);

$target1 =40;

/*if ($width > $height) {*/
$percentage1 = ($target1 / $width);
/*/*} else {
$percentage1 = ($target1 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width1 = round($width * $percentage1);
$new_height1 = round($height * $percentage1); 


// Resample
$image_p1 = imagecreatetruecolor($new_width1, $new_height1);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p1, $image, 0, 0, 0, 0, $new_width1, $new_height1, $width, $height);
// Output
imagejpeg($image_p1, $upload_file1);
	

$target2 =90;

/*if ($width > $height) {*/
$percentage2 = ($target2 / $width);
/*} else {
$percentage2 = ($target2 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width2 = round($width * $percentage2);
$new_height2 = round($height * $percentage2); 

	
// Resample
$image_p2 = imagecreatetruecolor($new_width2, $new_height2);
imagecopyresampled($image_p2, $image, 0, 0, 0, 0, $new_width2, $new_height2, $width, $height);
// Output
imagejpeg($image_p2, $upload_file2);	


	

$target3 =130;

/*if ($width > $height) {*/
$percentage3 = ($target3 / $width);
/*} else {
$percentage3 = ($target3 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width3 = round($width * $percentage3);
$new_height3 = round($height * $percentage3); 

	
// Resample
$image_p3 = imagecreatetruecolor($new_width3, $new_height3);
imagecopyresampled($image_p3, $image, 0, 0, 0, 0, $new_width3, $new_height3, $width, $height);
// Output
imagejpeg($image_p3, $upload_file3);	

$target4 =150;

/*if ($width > $height) {*/
$percentage4 = ($target4 / $width);
/*} else {
$percentage4 = ($target4 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width4 = round($width * $percentage4);
$new_height4 = round($height * $percentage4); 

	
// Resample
$image_p4 = imagecreatetruecolor($new_width4, $new_height4);
imagecopyresampled($image_p4, $image, 0, 0, 0, 0, $new_width4, $new_height4, $width, $height);
// Output
imagejpeg($image_p4, $upload_file4);


$target5 =400;

/*if ($width > $height) {*/
$percentage5 = ($target5 / $width);
/*} else {
$percentage5 = ($target5 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width5 = round($width * $percentage5);
$new_height5 = round($height * $percentage5); 

	
// Resample
$image_p5 = imagecreatetruecolor($new_width5, $new_height5);
imagecopyresampled($image_p5, $image, 0, 0, 0, 0, $new_width5, $new_height5, $width, $height);
// Output
imagejpeg($image_p5, $upload_file5);	


$target6 =445;

///*if ($width > $height) {*/
$percentage6 = ($target6 / $width);
//} else {
//$percentage6 = ($target6 / $height);
//}

//gets the new value and applies the percentage, then rounds the value
$new_width6 = round($width * $percentage6);
$new_height6 = round($height * $percentage6); 

	
// Resample
$image_p6 = imagecreatetruecolor($new_width6, $new_height6);
imagecopyresampled($image_p6, $image, 0, 0, 0, 0, $new_width6, $new_height6, $width, $height);
// Output
imagepng($image_p6, $upload_file6);	

unlink($filename);

}




function gifimage($filename,$upload_file1,$upload_file2,$upload_file3,$upload_file4,$upload_file5,$upload_file6)
{
header('Content-type: image/gif');

// Get new dimensions
list($width, $height) = getimagesize($filename);

$target1 =50;

/*if ($width > $height) {*/
$percentage1 = ($target1 / $width);
/*} else {
$percentage1 = ($target1 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width1 = round($width * $percentage1);
$new_height1 = round($height * $percentage1); 


// Resample
$image_p1 = imagecreatetruecolor($new_width1, $new_height1);
$image = imagecreatefromgif($filename);
imagecopyresampled($image_p1, $image, 0, 0, 0, 0, $new_width1, $new_height1, $width, $height);
// Output
imagejpeg($image_p1, $upload_file1);
	

$target2 =90;

/*if ($width > $height) {*/
$percentage2 = ($target2 / $width);
/*} else {
$percentage2 = ($target2 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width2 = round($width * $percentage2);
$new_height2 = round($height * $percentage2); 

	
// Resample
$image_p2 = imagecreatetruecolor($new_width2, $new_height2);
imagecopyresampled($image_p2, $image, 0, 0, 0, 0, $new_width2, $new_height2, $width, $height);
// Output
imagejpeg($image_p2, $upload_file2);	
	

$target3 =130;

/*if ($width > $height) {*/
$percentage3 = ($target3 / $width);
/*} else {
$percentage3 = ($target3 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width3 = round($width * $percentage3);
$new_height3 = round($height * $percentage3); 

	
// Resample
$image_p3 = imagecreatetruecolor($new_width3, $new_height3);
imagecopyresampled($image_p3, $image, 0, 0, 0, 0, $new_width3, $new_height3, $width, $height);
// Output
imagegif($image_p3, $upload_file3);	


$target4 =150;

/*if ($width > $height) {*/
$percentage4 = ($target4 / $width);
/*} else {
$percentage4 = ($target4 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width4 = round($width * $percentage4);
$new_height4 = round($height * $percentage4); 

	
// Resample
$image_p4 = imagecreatetruecolor($new_width4, $new_height4);
imagecopyresampled($image_p4, $image, 0, 0, 0, 0, $new_width4, $new_height4, $width, $height);
// Output
imagegif($image_p4, $upload_file4);	

$target5 =400;

/*if ($width > $height) {*/
$percentage5 = ($target5 / $width);
/*} else {
$percentage5 = ($target5 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width5 = round($width * $percentage5);
$new_height5 = round($height * $percentage5); 

	
// Resample
$image_p5 = imagecreatetruecolor($new_width5, $new_height5);
imagecopyresampled($image_p5, $image, 0, 0, 0, 0, $new_width5, $new_height5, $width, $height);
// Output
imagegif($image_p5, $upload_file5);	

$target6 =445;

///*if ($width > $height) {*/
$percentage6 = ($target6 / $width);
//} else {
//$percentage6 = ($target6 / $height);
//}

//gets the new value and applies the percentage, then rounds the value
$new_width6 = round($width * $percentage6);
$new_height6 = round($height * $percentage6); 

	
// Resample
$image_p6 = imagecreatetruecolor($new_width6, $new_height6);
imagecopyresampled($image_p6, $image, 0, 0, 0, 0, $new_width6, $new_height6, $width, $height);
// Output
imagepng($image_p6, $upload_file6);	


unlink($filename);
}


function pngimage($filename,$upload_file1,$upload_file2,$upload_file3,$upload_file4,$upload_file5,$upload_file6)
{
header('Content-type: image/png');

// Get new dimensions
list($width, $height) = getimagesize($filename);

$target1 =50;

/*if ($width > $height) {*/
$percentage1 = ($target1 / $width);
/*} else {
$percentage1 = ($target1 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width1 = round($width * $percentage1);
$new_height1 = round($height * $percentage1); 


// Resample
$image_p1 = imagecreatetruecolor($new_width1, $new_height1);
$image = imagecreatefrompng($filename);
imagecopyresampled($image_p1, $image, 0, 0, 0, 0, $new_width1, $new_height1, $width, $height);
// Output
imagepng($image_p1, $upload_file1);
	

$target2 =90;

/*if ($width > $height) {*/
$percentage2 = ($target2 / $width);
/*} else {
$percentage2 = ($target2 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width2 = round($width * $percentage2);
$new_height2 = round($height * $percentage2); 

	
// Resample
$image_p2 = imagecreatetruecolor($new_width2, $new_height2);
imagecopyresampled($image_p2, $image, 0, 0, 0, 0, $new_width2, $new_height2, $width, $height);
// Output
imagepng($image_p2, $upload_file2);	
	

$target3 =130;

/*if ($width > $height) {*/
$percentage3 = ($target3 / $width);
/*} else {
$percentage3 = ($target3 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width3 = round($width * $percentage3);
$new_height3 = round($height * $percentage3); 

	
// Resample
$image_p3 = imagecreatetruecolor($new_width3, $new_height3);
imagecopyresampled($image_p3, $image, 0, 0, 0, 0, $new_width3, $new_height3, $width, $height);
// Output
imagepng($image_p3, $upload_file3);	



$target4 =150;

/*if ($width > $height) {*/
$percentage4 = ($target4 / $width);
/*} else {
$percentage4 = ($target4 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width4 = round($width * $percentage4);
$new_height4 = round($height * $percentage4); 

	
// Resample
$image_p4 = imagecreatetruecolor($new_width4, $new_height4);
imagecopyresampled($image_p4, $image, 0, 0, 0, 0, $new_width4, $new_height4, $width, $height);
// Output
imagepng($image_p4, $upload_file4);	

$target5 =400;

/*if ($width > $height) {*/
$percentage5 = ($target5 / $width);
/*} else {
$percentage5 = ($target5 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width5 = round($width * $percentage5);
$new_height5 = round($height * $percentage5); 

	
// Resample
$image_p5 = imagecreatetruecolor($new_width5, $new_height5);
imagecopyresampled($image_p5, $image, 0, 0, 0, 0, $new_width5, $new_height5, $width, $height);
// Output
imagepng($image_p5, $upload_file5);	

$target6 =445;

///*if ($width > $height) {*/
$percentage6 = ($target6 / $width);
//} else {
//$percentage6 = ($target6 / $height);
//}

//gets the new value and applies the percentage, then rounds the value
$new_width6 = round($width * $percentage6);
$new_height6 = round($height * $percentage6); 

	
// Resample
$image_p6 = imagecreatetruecolor($new_width6, $new_height6);
imagecopyresampled($image_p6, $image, 0, 0, 0, 0, $new_width6, $new_height6, $width, $height);
// Output
imagepng($image_p6, $upload_file6);	

unlink($filename);
}

function jpgimage_new($filename,$upload_file1,$upload_file2)
{
	// Content type
header('Content-type: image/jpeg');

// Get new dimensions
list($width, $height) = getimagesize($filename);

$target1 =55;

/*if ($width > $height) {*/
$percentage1 = ($target1 / $width);
/*} else {
$percentage1 = ($target1 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width1 = round($width * $percentage1);
$new_height1 = round($height * $percentage1); 


// Resample
$image_p1 = imagecreatetruecolor($new_width1, $new_height1);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p1, $image, 0, 0, 0, 0, $new_width1, $new_height1, $width, $height);
// Output
imagejpeg($image_p1, $upload_file1);



$target2 =400;

/*if ($width > $height) {*/
$percentage2 = ($target2 / $width);
/*} else {
$percentage2 = ($target2 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width2= round($width * $percentage2);
$new_height2 = round($height * $percentage2); 

	
// Resample
$image_p2 = imagecreatetruecolor($new_width2, $new_height2);
imagecopyresampled($image_p2, $image, 0, 0, 0, 0, $new_width2, $new_height2, $width, $height);
// Output
imagejpeg($image_p2, $upload_file2);	

unlink($filename);

}




function gifimage_new($filename,$upload_file1,$upload_file2)
{
header('Content-type: image/gif');

// Get new dimensions
list($width, $height) = getimagesize($filename);

$target1 =55;

/*if ($width > $height) {*/
$percentage1 = ($target1 / $width);
/*} else {
$percentage1 = ($target1 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width1 = round($width * $percentage1);
$new_height1 = round($height * $percentage1); 


// Resample
$image_p1 = imagecreatetruecolor($new_width1, $new_height1);
$image = imagecreatefromgif($filename);
imagecopyresampled($image_p1, $image, 0, 0, 0, 0, $new_width1, $new_height1, $width, $height);
// Output
imagejpeg($image_p1, $upload_file1);
	

$target2 =400;

/*if ($width > $height) {*/
$percentage2 = ($target2 / $width);
/*} else {
$percentage2 = ($target2 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width2 = round($width * $percentage2);
$new_height2 = round($height * $percentage2); 

	
// Resample
$image_p2 = imagecreatetruecolor($new_width2, $new_height2);
imagecopyresampled($image_p2, $image, 0, 0, 0, 0, $new_width2, $new_height2, $width, $height);
// Output
imagejpeg($image_p2, $upload_file2);	


unlink($filename);
}


function pngimage_new($filename,$upload_file1,$upload_file2)
{
header('Content-type: image/png');

// Get new dimensions
list($width, $height) = getimagesize($filename);

$target1 =50;

/*if ($width > $height) {*/
$percentage1 = ($target1 / $width);
/*} else {
$percentage1 = ($target1 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width1 = round($width * $percentage1);
$new_height1 = round($height * $percentage1); 


// Resample
$image_p1 = imagecreatetruecolor($new_width1, $new_height1);
$image = imagecreatefrompng($filename);
imagecopyresampled($image_p1, $image, 0, 0, 0, 0, $new_width1, $new_height1, $width, $height);
// Output
imagepng($image_p1, $upload_file1);
	

$target2 =400;

/*if ($width > $height) {*/
$percentage2 = ($target2 / $width);
/*} else {
$percentage2 = ($target2 / $height);
}*/

//gets the new value and applies the percentage, then rounds the value
$new_width2 = round($width * $percentage2);
$new_height2 = round($height * $percentage2); 

	
// Resample
$image_p2 = imagecreatetruecolor($new_width2, $new_height2);
imagecopyresampled($image_p2, $image, 0, 0, 0, 0, $new_width2, $new_height2, $width, $height);
// Output
imagepng($image_p2, $upload_file2);	

unlink($filename);
}

function banner_jpgimage($filename,$upload_file6)
{
	// Content type
header('Content-type: image/jpeg');

// Get new dimensions
list($width, $height) = getimagesize($filename);


//gets the new value and applies the percentage, then rounds the value
$new_width6 = 157;
$new_height6 = 103; 
$image = imagecreatefromjpeg($filename);
	
// Resample
$image_p6 = imagecreatetruecolor($new_width6, $new_height6);
imagecopyresampled($image_p6, $image, 0, 0, 0, 0, $new_width6, $new_height6, $width, $height);
// Output
imagepng($image_p6, $upload_file6);	

unlink($filename);

}


function banner_gifimage($filename,$upload_file6)
{
header('Content-type: image/gif');

// Get new dimensions
list($width, $height) = getimagesize($filename);

$new_width6 = 157;
$new_height6 = 103; 

$image = imagecreatefromgif($filename);	
// Resample
$image_p6 = imagecreatetruecolor($new_width6, $new_height6);
imagecopyresampled($image_p6, $image, 0, 0, 0, 0, $new_width6, $new_height6, $width, $height);
// Output
imagepng($image_p6, $upload_file6);	


unlink($filename);
}


function banner_pngimage($filename,$upload_file6)
{
header('Content-type: image/png');

// Get new dimensions
list($width, $height) = getimagesize($filename);

$new_width6 = 157;
$new_height6 = 103; 

$image = imagecreatefrompng($filename);
// Resample
$image_p6 = imagecreatetruecolor($new_width6, $new_height6);
imagecopyresampled($image_p6, $image, 0, 0, 0, 0, $new_width6, $new_height6, $width, $height);
// Output
imagepng($image_p6, $upload_file6);	

unlink($filename);
}
?>