Merge branch 'master' into kevin-prototype
This commit is contained in:
@@ -186,12 +186,21 @@ function doChangeEmail($email) {
|
||||
|
||||
function updateAvatar() {
|
||||
$profilePictureDir = "/var/www/html/public/";
|
||||
$relativePath = "uploads/profilepictures/" . $_SESSION["userID"] . "_avatar.png";
|
||||
$tmpImg = $_FILES["pp"]["tmp_name"];
|
||||
|
||||
checkAvatarSize($_FILES["pp"]["tmp_name"]);
|
||||
$scaledImg = scaleAvatar($_FILES["pp"]["tmp_name"]);
|
||||
checkAvatarSize($tmpImg);
|
||||
removeOldAvatar();
|
||||
imagepng($scaledImg, $profilePictureDir . $relativePath);
|
||||
if (getimagesize($tmpImg)["mime"] == "image/gif") {
|
||||
if ($_FILES["pp"]["size"] > 4000000) {
|
||||
throw new AngryAlert("Bestand is te groot, maximaal 4MB toegestaan.");
|
||||
}
|
||||
$relativePath = "uploads/profilepictures/" . $_SESSION["userID"] . "_avatar.gif";
|
||||
move_uploaded_file($tmpImg, $profilePictureDir . $relativePath);
|
||||
} else {
|
||||
$relativePath = "uploads/profilepictures/" . $_SESSION["userID"] . "_avatar.png";
|
||||
$scaledImg = scaleAvatar($tmpImg);
|
||||
imagepng($scaledImg, $profilePictureDir . $relativePath);
|
||||
}
|
||||
setAvatarToDatabase("../" . $relativePath);
|
||||
throw new HappyAlert("Profielfoto veranderd.");
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ $settings = getSettings();
|
||||
<div class="settings">
|
||||
<?php
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
echo "<div class='platform settings-message ". $alertClass ."'>".
|
||||
$alertMessage .
|
||||
"</div>";
|
||||
echo "<div class='platform settings-message $alertClass '>
|
||||
$alertMessage
|
||||
</div>";
|
||||
}
|
||||
?>
|
||||
<form class="settings-profile platform" method="post">
|
||||
@@ -81,7 +81,8 @@ $settings = getSettings();
|
||||
<label>Selecteer foto</label>
|
||||
<input type="file"
|
||||
name="pp"
|
||||
accept="image/jpeg,image/gif,image/png"
|
||||
accept="image/*"
|
||||
size="4000000"
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
|
||||
Reference in New Issue
Block a user