| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/HostingSpaces/admin/penpaleurope.com/backup/app/Penpal/ |
Upload File : |
<?php
include "general.php";
//error_reporting(E_ALL);
// we first include the upload class, as we will need it here to deal with the uploaded file
include('./src/class.upload.php');
$palid =$_SESSION['palid'];
// set variables
$dir_dest = "./assets/img/subscribers/".$palid."/profile/";//(isset($_GET['dir']) ? $_GET['dir'] : 'tmp');
$dir_pics = "./assets/img/subscribers/".$palid."/profile/";//(isset($_GET['pics']) ? $_GET['pics'] : $dir_dest);
//$palid = $_SESSION['palid'];
//$rotate = $_POST["rotate"];
// $image_name = $_POST['image'];
// echo $name."nosa";
$handle = new Upload($_FILES['file']);
// then we check if the file has been uploaded properly
// in its *temporary* location in the server (often, it is /tmp)
if ($handle ->file_is_image){
if ($handle->uploaded) {
// yes, the file is on the server
// below are some example settings which can be used if the uploaded file is an image.
//profile picture
$handle->image_auto_rotate = true;
$handle->file_new_name_body = $palid;
$handle->image_convert = jpg;
$handle->image_resize = true;
//$handle->image_ratio_y = true;
$handle->image_ratio_crop = true;
$handle->image_x = 48;
$handle->image_y = 48;
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
if(($handle->image_src_x < 800) and ( image_src_y < 800)){
// echo "The Photo is too small. Please upload file above 180 Pixels for both width and height";
$handle-> Clean();
echo "<p style='color:red'>The Photo is too small. Please upload file above 200 Pixels but below 35000 pixels for both width and height </p>";
die();
}
if(($handle->image_src_x > 3500) and ( image_src_y > 3500)){
// echo "The Photo is too small. Please upload file above 180 Pixels for both width and height";
$handle-> Clean();
echo "<p style='color:blue'>The Photo is too big. Please upload file above 200 Pixels and below 3500 pixels for both width and height </p>";
die();
}
//$dir_dest = "./assets/img/subscribers/".$palid."/";//(isset($_GET['dir']) ? $_GET['dir'] : 'tmp');
//$dir_pics = "./assets/img/subscribers/".$palid."/";//(isset($_GET['pics']) ? $_GET['pics'] : $dir_dest);
// now, we start the upload 'process'. That is, to copy the uploaded file
// from its temporary location to the wanted location
// It could be something like $handle->Process('/home/www/my_uploads/');
$handle->Process($dir_dest);
$dir_dest = "./assets/img/subscribers/".$palid."/thumbnail/";//(isset($_GET['dir']) ? $_GET['dir'] : 'tmp');
$dir_pics = "./assets/img/subscribers/".$palid."/thumbnail/";//(isset($_GET['pics']) ? $_GET['pics'] : $dir_dest);
// thumbnail picture
if ($handle->processed) {
$handle->file_new_name_body = $palid;
$handle->image_convert = jpg;
$handle->image_resize = true;
$handle->image_ratio_crop =true;
//$handle->image_ratio_y = true;
$handle->image_x = 200;
$handle->image_y = 200;
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
// $dir_dest = "./uploades/small/";//(isset($_GET['dir']) ? $_GET['dir'] : 'tmp');
//$dir_pics = "./uploades/small/";//(isset($_GET['pics']) ? $_GET['pics'] : $dir_dest);
$handle->Process($dir_dest);
//if ($handle->processed) {
// $handle-> Clean();
//}
}
// gallery picture
$dir_dest = "./assets/img/subscribers/".$palid."/gallery/";//(isset($_GET['dir']) ? $_GET['dir'] : 'tmp');
$dir_pics = "./assets/img/subscribers/".$palid."/gallery/";//(isset($_GET['pics']) ? $_GET['pics'] : $dir_dest);
if ($handle->processed) {
$handle->file_new_name_body = $palid;
$handle->image_convert = jpg;
$handle->image_resize = true;
$handle->image_ratio_crop =true;
//$handle->image_ratio_y = true;
$handle->image_x = 800;
$handle->image_y = 800;
if($rotate != "")
$handle->image_rotate = $rotate;
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
// $dir_dest = "./uploades/small/";//(isset($_GET['dir']) ? $_GET['dir'] : 'tmp');
//$dir_pics = "./uploades/small/";//(isset($_GET['pics']) ? $_GET['pics'] : $dir_dest);
$handle->Process($dir_dest);
if ($handle->processed) {
$handle-> Clean();
$query = "update penpalsubscriber set photo='1',status='1' where palid ='". $_SESSION['palid']."'";
$response = updateQuery( $query);
echo "<p style='color:blue'>Photo Uploaded Successfully</p>";
die();
}
} else {
// one error occured
// echo '<p class="result">';
// echo ' <b>File not uploaded to the wanted location</b><br />';
// echo ' Error: ' . $handle->error . '';
// echo '</p>';
$handle-> Clean();
echo "<p style='color:red'>There was error while processing your photo. Please try again with another photo</p>";
die();
}
// we now process the image a second time, with some other settings
} else {
// if we're here, the upload file failed for some reasons
// i.e. the server didn't receive the file
// echo '<p class="result">';
// echo ' <b>File not uploaded on the server</b><br />';
// echo ' Error: ' . $handle->error . '';
// echo '</p>';
$handle-> Clean();
echo "<p style='color:red'>There was error while uploading your photo. Please can you upload another photo<</p>";
die();
}
}else{
// not image file
//echo "This is not an accepted image file. Kindly upload JPG, PNG or GIF ";
//echo $handle->log;
$handle-> Clean();
echo "<p style='color:red'>This is not an accepted image file. Kindly upload JPG, PNG or GIF </p>";
//echo "nosa";
die();
}
?>