Update image handling for display picture operations

This commit is contained in:
netkas 2025-01-06 04:47:56 -05:00
parent 426df31421
commit 746744eb64
2 changed files with 10 additions and 5 deletions

View file

@ -471,11 +471,19 @@
if($peer->isExternal())
{
// TODO: Implement this
throw new InvalidArgumentException('Cannot delete the display picture of an external peer');
}
Logger::getLogger()->verbose(sprintf("Deleting display picture of peer %s", $peer->getUuid()));
// Delete the file if it exists
$displayPicturePath = Configuration::getStorageConfiguration()->getUserDisplayImagesPath() . DIRECTORY_SEPARATOR . $peer->getDisplayPicture() . '.jpeg';
if(file_exists($displayPicturePath))
{
unlink($displayPicturePath);
}
try
{
$statement = Database::getConnection()->prepare('UPDATE `registered_peers` SET display_picture=NULL WHERE uuid=?');