You see, I have occupied the following function to be able to obtain the data of my current session:
public function login(){
$username = $this->input->post("username");
$password = $this->input->post("password");
$res = $this->Usuarios_model->login($username, sha1($password));
if (!$res) {
$this->session->set_flashdata("error","El usuario y/o contraseña son incorrectos");
redirect(base_url());
}
else{
$data = array(
'id' => $res->id_Usuarios,
'username' => $res->username,
'rol1' => $res->nombre,
'rol' => $res->rol_id,
'imagen_usr' => $res->imagen,
'login' => TRUE
);
$this->session->set_userdata($data);
redirect(base_url()."index");
}
}
And I wanted to show an image for the "profile" of my system.
The route where it is located is as a field in my database, and the image is in its respective folder:
I always showed the data obtained from my current session in the following way:
<span class="hidden-xs"><?php echo $this->session->userdata("username")?></span>
And what I tried to do to show the image was:
<img src="<?php echo base_url() ?>uploads/perfil/<?php echo $this->session->userdata("imagen_usr")?>" class="logo-lg" alt="User Image">
But I did not succeed ... And I also tried other 3 ways, but nothing.