| Server IP : 172.67.216.113 / Your IP : 104.23.243.32 [ Web Server : Apache System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64 User : cp648411 ( 1354) PHP Version : 7.2.34 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home2/cp648411/public_html/kainumber.com/convertWebp/ |
Upload File : |
<?php
/*
echo "<pre>";
print_r($_POST);
echo "</pre>";
echo "<pre>";
print_r($_FILES);
echo "</pre>";
*/
$image = $_FILES['file']['name'];
$file_tmp =$_FILES['file']['tmp_name'];
$file_type =$_FILES['file']['type'];
$dir=$_POST['dir'];
$exp = explode('.' , $image);
///$newName=time().".webp";
$newName=$exp[0].".webp";
$path = $_POST['path'];
if(move_uploaded_file($file_tmp,$dir.$image)){
if($file_type=='image/jpeg'){
//$img = imagecreatefromjpeg($dir . $image);
}else {
// $img = imagecreatefrompng($dir . $image);
}
$quality = 100;
//Create the webp image.
imagewebp($img, $dir . $newName, $quality);
imagedestroy($img);
echo "success";
}else{
echo "error";
}
?>
<button type="button" name="button"
onclick="window.location.href='index.php?path=<?php echo $path; ?>'"
>back</button>