Kakshak Kakshak - 1 year ago 120
PHP Question

How to add an image in codeigniter

I m learing codeigniter and i want to add an image in my view page.
I am using tag but the image is not added in the page.
So help me how i can add the image in view page of codigniter.

<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<h2><img src="../images/logo.png"></h2>
<?php $this->load->view('blog/menu');
if ($query):foreach ($query as $post): ?>
<h4><?php echo $post->entry_name; ?> (<?php echo $post->entry_date; ?>)</h4>
<?php echo $post->entry_body; ?>
<?php endforeach;
else: ?>
<h4>No entry yet!</h4>
<?php endif; ?>

Answer Source

store images in an images folder at the same level as the application folder . then just link to it like this using code.

<img src="<?php echo base_url('images/logo.png'); ?>" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download