I am trying to show user image in navbar top section like Username "Image" just like in this site or any other.
This is what i try.
View
<li class="">
<a href="#" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<img src="<?php echo base_url(); ?>profileimages/<?php if (isset($_SESSION['Prof']))
{
echo $_SESSION['Prof'];
}?>" alt=""><?php echo $admin;?>
<span class=" fa fa-angle-down"></span>
</a>
<ul class="dropdown-menu dropdown-usermenu pull-right">
<li><a href="Profile"> Profile</a></li>
<li><a href="Profile_Setting"> Setting</a></li>
<li><a href="logout"><i class="fa fa-sign-out pull-right"></i> Log Out</a></li>
</ul>
</li>
I am putting the image in session in login model,
Model
public function login_admin($username,$password)
{
$query=$this->db->where(['Username'=>$username,'Password'=>$password])->get('dc_admin');
if($query->num_rows()>0)
{
foreach ($query->result() as $row)
{
$q=$row->Profile_Picture;
$_SESSION['Prof']=$q;
}
$this->session->set_userdata('logged_in',$username);
redirect('Master/Users');
}
else
{
redirect('Master');
}
}
I am new in CI and try to learn, please tell what i can do here to get image, i am able to get the logged IN username but not the image.
Any help will be appreciated.