if else 状态如下:
if ( isset( $_POST['submit'] ) ) {
$extension = end(explode(".", $_FILES["file"]["name"]));
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 60000)
&& in_array($extension, $allowedExts)){
if ($_FILES["file"]["error"] > 0)
{
// Do something
} else{
if (file_exists(EXAMPLE_IMAGES_PATH . $_FILES["file"]["name"])) {
// Do something
} else{
// Apply resize then -
move_uploaded_file($_FILES["file"]["tmp_name"],
EXAMPLE_IMAGES_PATH . $_FILES["file"]["name"]);
// Do something else
}
}
}
else{
// Do something else
}
}
在 move_uploaded_file 我想让它的大小调整为
$uploadedfile = $_FILES['file']['tmp_name'];
$imgW = 290; // Width of img to be uploaded
$imgH = 290; // Height of img to be uploaded
imagecreatetruecolor($imgW,$imgH);
我不确定如何在上传前调整图像大小。提前感谢所有提供帮助的人。