Kevin prototype #110
@@ -186,12 +186,21 @@ function doChangeEmail($email) {
|
|||||||
|
|
||||||
function updateAvatar() {
|
function updateAvatar() {
|
||||||
$profilePictureDir = "/var/www/html/public/";
|
$profilePictureDir = "/var/www/html/public/";
|
||||||
$relativePath = "uploads/profilepictures/" . $_SESSION["userID"] . "_avatar.png";
|
$tmpImg = $_FILES["pp"]["tmp_name"];
|
||||||
|
|
||||||
checkAvatarSize($_FILES["pp"]["tmp_name"]);
|
checkAvatarSize($tmpImg);
|
||||||
$scaledImg = scaleAvatar($_FILES["pp"]["tmp_name"]);
|
|
||||||
removeOldAvatar();
|
removeOldAvatar();
|
||||||
|
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);
|
imagepng($scaledImg, $profilePictureDir . $relativePath);
|
||||||
|
}
|
||||||
setAvatarToDatabase("../" . $relativePath);
|
setAvatarToDatabase("../" . $relativePath);
|
||||||
throw new HappyAlert("Profielfoto veranderd.");
|
throw new HappyAlert("Profielfoto veranderd.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ $settings = getSettings();
|
|||||||
<div class="settings">
|
<div class="settings">
|
||||||
<?php
|
<?php
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
echo "<div class='platform settings-message ". $alertClass ."'>".
|
echo "<div class='platform settings-message $alertClass '>
|
||||||
$alertMessage .
|
$alertMessage
|
||||||
"</div>";
|
</div>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<form class="settings-profile platform" method="post">
|
<form class="settings-profile platform" method="post">
|
||||||
@@ -81,7 +81,8 @@ $settings = getSettings();
|
|||||||
<label>Selecteer foto</label>
|
<label>Selecteer foto</label>
|
||||||
<input type="file"
|
<input type="file"
|
||||||
name="pp"
|
name="pp"
|
||||||
accept="image/jpeg,image/gif,image/png"
|
accept="image/*"
|
||||||
|
size="4000000"
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
Reference in New Issue
Block a user