Using session to display images

When a user logs in and CI loads it from the database. I'm trying to get CI to display the image.

$data = array(
  'user_rank'   => 'pro-guest.png';

Then I try and display this on the page.

echo '<img src="images/ranks/'.$this-&gt;session-&gt;userdata('user_rank').' ">';

So far nothing I tried seems to work. Any one have any ideas.


To avoid wrong URIs, try using

echo '<img src="' . base_url('images/ranks/' . $this-&gt;session-&gt;userdata('user_rank')) . '" />';

or even better with the img-helper

echo img('images/ranks/' . $this->session->userdata('user_rank'));

If you still don't see the image, make sure it is where it's supposed to be Wink

Thank you. That seems to work. It looks like I didn't type it in right. I had some in the ' and " missing and I fixed them

Thanks Again

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.