Linux 5.6.20 版 XAMPP 未在 lubuntu 16.04lts 中显示使用 php 上传的文件

Linux 5.6.20 版 XAMPP 未在 lubuntu 16.04lts 中显示使用 php 上传的文件

Linux 5.6.20 版 XAMPP 未在 lubuntu 16.04lts 中显示使用 php 上传的文件

`

include 'header.php';
 $profile_id=$user['username'];
$imgSrc="";
$result_path="";
$msg="";

if(!isset($_POST['x']) && !isset($_FILES['image']['name'])){
  $temppath='profile_pics/'.$profile_id.'_temp.jpeg';
  if(file_exists($temppath)){@unlink($temppath);}
 }
if(isset($_FILES['image']['name'])){


$ImageName=$_FILES['image']['name'];


$ImageSize=$_FILES['image']['size'];

$ImageTempName=$_FILES['image']['tmp_name'];


$ImageType=@explode('/',$_FILES['image']['type']);

$type=$ImageType[1];

$uploaddir=$_SERVER['DOCUMENT_ROOT']."/profile_pics";
$file_temp_name=$profile_id.'_original.'.md5(time()).'n'.$type;
$fullpath=$uploaddir."/".$file_temp_name;

$file_name=$profile_id.'_temp.jpeg';
$fullpath_2=$uploaddir."/".$file_name;


$move=move_uploaded_file($ImageTempName,$fullpath);


 chmod($fullpath,0777);


 if(!$move){


 die('file not uploaded');
   }
else{
  $imgSrc="profile_pics/".$file_name;
   $msg="upload complete";
    $src=$file_name;



  }
  clearstatcache();
  $original_size=getimagesize($fullpath);
  $original_width=$original_size[0];
  $original_height=$original_size[1];
  $main_width=500;
  $main_height=$original_height/($original_width/main_width);
  if($_FILES["image"]["type"]=="image/gif"){
    $src2=imagecreatefromgif($fullpath);
  }
  elseif($_FILES["image"]["type"]=="image/jpeg" || $_FILES["image"] 
  ["type"]=="image/pjpeg"){
    $src2=imagecreatefromjpeg($fullpath);
  }
  elseif($_FILES["image"]["type"]=="image/png"){
    $src2=imagecreatefrompng($fullpath);
  }else{
    $msg.="There was an error uploading the file please upload a .jpg, 
.gif or .png file <br/>";
}
$main=imagecreatetruecolor($main_width,$main_height);

imagecopyresampled($main,$src2,0,0,0,0,$main_width,$main_height,$original_ width,$original_height);$main_temp=$fullpath_2;imagejpeg($main,$main_temp,90);chmod($main_temp,0777);imagedestroy($src2);imagedestroy($main);@ unlink($fullpath);

} 如果(isset($_POST['x'])){ $type=$_POST['type']; $src='profile_pics/'.$_POST['src']; $finalname=$profile_id.md5(time()); 如果($type=='jpg'||$type=='jpeg'||$type=='JPG'||$type=='JPEG'){ $targ_w=$targ_h=1500; $jpeg_quality=90; $img_r=imagecreatefromjpeg($src); $dst_r=imagecreatetruecolor($targ_w,$targ_h); imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],$targ_w,$targ_h,$_POST['w'],$_POST['h']); imagejpeg($dst_r,"profile_pics/".$finalname."n.jpeg",90);

}else if($type=='png'||$type=='PNG'){
    $targ_w=$targ_h=150;
    $jpeg_quality=90;
    $img_r=imagecreatefrompng($src);
    $dst_r=imagecreatetruecolor($targ_w,$targ_h);
    imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],$targ_w,$targ_h,$_POST['w'],$_POST['h']);
    imagejpeg($dst_r,"profile_pics/".$finalname."n.jpeg",90);
    }else if($type=='gif'||$type=='GIF'){
    $targ_w=$targ_h=150;
    $jpeg_quality=90;
    $img_r=imagecreatefromgif($src);
    $dst_r=imagecreatetruecolor($targ_w,$targ_h);
    imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],$targ_w,$targ_h,$_POST['w'],$_POST['h']);
    imagejpeg($dst_r,"profile_pics/".$finalname."n.jpeg",90);
}

imagedestroy($img_r);
imagedestroy($dst_r);
@ unlink($src);
$result_path="profile_pics/".$finalname."n.jpeg";
$insert_pic_query=mysqli_query($db,"UPDATE profile SET image='$result_path' WHERE username='$userLoggedIn'");
header("Location:" .$userLoggedIn);

>

上传一些内容:





$('#Overlay').show(); $('#formExample').hide(); " border="0" id="jcrop_target" style="border:0px #990000 solid; position:relative; margin:0px 0px 0px 0px; padding=0px;"/>

剪裁个人资料图片



裁剪/调整您上传的个人资料图片的大小
如果您对您的个人资料图片满意,请单击保存。


“名称=“src”/>“样式=“位置:相对;边距:10px自动;宽度:150px;高度:150px;”/>

?>

`

相关内容