'Change profile picture while log out PHP

on my app when user log out, there is a redirection to login page and email is unset but I also want to unset the profile picture because right now when user is redirect to login page it display his profile picture even though he's log out. I want to display default picture which is './assets/profile-picture/avatar.jpg'

The code looks like that:

<?php
session_start();
unset($_SESSION['email']);
$_SESSION['profileImage'] = './assets/profile-picture/avatar.jpg';
// unset ($_SESSION['profileImage']);

header("Location: login.php");

exit;
?>


             



<img src=<?php echo isset($user['profileImage']) ? $user['profileImage']: "./assets/profile-picture/avatar.jpg" ; ?> style="width: 200px; height: 200px" class="img rounded-circle" alt="profile">

I also try unset which is comment but none of that worked. Thanks for any clue.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source