Images return full URI (excl. host)

This commit is contained in:
2024-07-28 01:58:16 +02:00
parent 215ed1bc7f
commit 93e5cebce0
5 changed files with 49 additions and 7 deletions
+3 -3
View File
@@ -363,13 +363,13 @@ class User implements JsonSerializable
$stmt->bindValue(":ID", $this->id);
$stmt->execute();
$oldImage = $stmt->fetch(PDO::FETCH_COLUMN, 0);
if (strpos($oldImage, "default") === false) unlink(Config::getStoragePath() . $oldImage);
if (strpos($oldImage, "default") === false) unlink(Config::getStorageFSPath() . $oldImage);
} catch (Exception $e) {
}
if (!empty($image)) {
$destinationFilename = sprintf('%s.%s', uniqid(), $image->getExtension());
$image->move(Config::getStoragePath() . "profilbilder/$destinationFilename");
$image->move(Config::getStorageFSPath() . "profilbilder/$destinationFilename");
try {
$stmt = $db->prepare("UPDATE egb_benutzer SET image = :IMG WHERE id = :ID");
@@ -524,7 +524,7 @@ class User implements JsonSerializable
'username' => $this->username,
'status' => $this->status,
'email' => htmlspecialchars($this->email),
'image' => $this->image,
'image' => Config::getStoragePath() . $this->image,
'isAdmin' => $this->isAdmin,
'memberSince' => $this->memberSince,
'postCount' => $this->postCount,