我在一个区块中有一个if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['ChangeAvatar'])) {
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["ChangeAvatarInput"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
$check = getimagesize($_FILES["ChangeAvatarInput"]["tmp_name"]);
if($check !== false) {
echo "File is an image - " . $check["mime"] . ".";
$uploadOk = 1;
} else {
echo "File is not an image.";
$uploadOk = 0;
}
if (file_exists($target_file)) {
echo "Sorry, file already exists.";
$uploadOk = 0;
}
if ($_FILES["ChangeAvatarInput"]["size"] > 500000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" ) {
echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
$uploadOk = 0;
}
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
} else {
if (move_uploaded_file($_FILES["ChangeAvatarInput"]["tmp_name"], $Username.".".$imageFileType)) {
echo "The file ". basename( $_FILES["ChangeAvatarInput"]["name"]). " has been uploaded.";
} else {
echo "Sorry, there was an error uploading your file.";
}
}
}
,如下面的页面链接所示。
我正在尝试按如下方式显示图像:
当我添加更多内容或删除内容时,我的图像似乎会增长和缩小。反正是为了使图像看起来比它大(理想情况下〜视口宽度的90%)并在各种屏幕分辨率下保持90%的尺寸?
谢谢。
答案 0 :(得分:1)
尝试:
background-size: 100% auto;