| 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";
//include "connect.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');
if ($_SESSION['palid'] ==""){
header('Location: login.php?err=1');
die();
}
$palid =$_SESSION['palid'];
// set variables
$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);
//$palid = $_SESSION['palid'];
//$rotate = $_POST["rotate"];
// $image_name = $_POST['image'];
// echo $name."nosa";
$handle = new Upload($_FILES['image']);
//die();
// 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
$img = $handle->file_src_name_body;
echo $img ."<br>";
$path = $handle->file_src_pathname;
echo $path;
$exif = @exif_read_data($handle->file_src_pathname,0,true);
$orientation = @$exif['IFD0']['Orientation'];
var_dump( $orientation);
echo "nosa";
exit();
$handle->image_rotate = 270;
$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;
if($rotate != "")
$handle->image_rotate = $rotate;
// $handle->image_ratio_fill = true;
$handle->image_x = 120;
$handle->image_y = 120;
$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();
header('Location: photo.php?err=2');
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();
header('Location: photo.php?err=4');
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);
// thumbnail picture
if ($handle->processed) {
$handle->file_new_name_body = "th_".$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;
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();
//}
}
// thumbnail picture
if ($handle->processed) {
$handle->file_new_name_body = "thf_".$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();
}
}
// upload picture
if ($handle->processed) {
$handle->file_new_name_body = "over_".$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->image_overlay_color = '#FFFFFF';
$handle->image_overlay_opacity = 50;
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();
} // everything was fine !
//echo '<p class="result">';
//echo ' <b>File uploaded with success</b><br />';
// echo ' <img src="'.$dir_pics.'/' . $handle->file_dst_name . '" />';
// $info = getimagesize($handle->file_dst_pathname);
// echo ' File: <a href="'.$dir_pics.'/' . $handle->file_dst_name . '">' . $handle->file_dst_name . '</a><br/>';
// echo ' (' . $info['mime'] . ' - ' . $info[0] . ' x ' . $info[1] .' - ' . round(filesize($handle->file_dst_pathname)/256)/4 . 'KB)';
//echo '</p>';
$handle-> Clean();
header('Location: photo.php?err=0');
} 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();
header('Location: photo.php?err=3');
}
// 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();
header('Location: photo.php?err=5');
die();
}
}else{
// not image file
//echo "This is not an accepted image file. Kindly upload JPG, PNG or GIF ";
$handle-> Clean();
header('Location: uploadphoto.php?err=6');
die();
}
?>