Welcome Guest, Not a member yet? Register   Sign In
How do I load an image?
#1

[eluser]johnnyForums[/eluser]
I am trying to use the html helper:

Code:
<?php echo img('inc/unembellished/images/img03.jpg');?>

But it will not load. I get the http://.... but the image never loads. The following footer loads so I know it can see that folder:

Code:
<?php $this->load->view('inc/unembellished/footer.php')?>

I also tried moving the image to the same level as the footer that is found:

Code:
<?php echo img('inc/unembellished/img03.jpg');?>

I don't know how to load the image. Footer is loaded but the image it not. Thank you for any help.

Here is the full code:
Code:
<?php $this->load->view('inc/unembellished/header.php')?>    

<div id="wrapper">
&lt;!-- start header --&gt;
<div id="header">
    <div id="logo">
        <h1><a href="#">MyTest 2009</a></h1>
        <h2> Design by Free Css Templates</h2>
    </div>
    <div id="menu">
        <ul>
            <li class="current_page_item"><a href="#">Homepage</a></li>
            <li><a href="#">Blogs</a><img src='&lt;?php echo  base_url() .  "inc/unembellished/img03.jpg;?&gt;"' /></li>
            <li><a href="#">Photos</a></li>
            <li><a href="#">About</a></li>
            <li class="last"><a href="#">Contact</a></li>
        </ul>
    </div>
</div>

&lt;!-- end page --&gt;
</div>


&lt;?php $this->load->view('inc/unembellished/footer.php')?&gt;

Header and footer load but not any images in the header or footer or here above.
#2

[eluser]johnnyForums[/eluser]
[quote author="johnnyForums" date="1248395695"]I am trying to use the html helper:

Code:
&lt;?php echo img('inc/unembellished/images/img03.jpg');?&gt;

But it will not load. I get the http://.... but the image never loads. The following footer loads so I know it can see that folder:

Code:
&lt;?php $this->load->view('inc/unembellished/footer.php')?&gt;

I also tried moving the image to the same level as the footer that is found:

Code:
&lt;?php echo img('inc/unembellished/img03.jpg');?&gt;

I don't know how to load the image. Footer is loaded but the image it not. Thank you for any help.

Here is the full code:
Code:
&lt;?php $this->load->view('inc/unembellished/header.php')?&gt;    

<div id="wrapper">
&lt;!-- start header --&gt;
<div id="header">
    <div id="logo">
        <h1><a href="#">MyTest 2009</a></h1>
        <h2> Design by Free Css Templates</h2>
    </div>
    <div id="menu">
        <ul>
            <li class="current_page_item"><a href="#">Homepage</a></li>
            <li><a href="#">Blogs</a><img src='&lt;?php echo  base_url() .  "inc/unembellished/img03.jpg;?&gt;"' /></li>
            <li><a href="#">Photos</a></li>
            <li><a href="#">About</a></li>
            <li class="last"><a href="#">Contact</a></li>
        </ul>
    </div>
</div>

&lt;!-- end page --&gt;
</div>


&lt;?php $this->load->view('inc/unembellished/footer.php')?&gt;

Header and footer load but not any images in the header or footer or here above.[/quote]

I ended up getting it with:

&lt;?php echo base_url() . 'inc/unembellished/'?&gt;
&lt;?php echo link_tag('inc/unembellished/default.css');?&gt;
background: #FFFFFF url( &lt;?php echo base_url() . 'inc/unembellished/'?&gt;images/img01.jpg) repeat-x left top;

and so on. But, to make this work I had to move in "inc" folder outside of my codeigniter system directory

I have:

/library/documents/myCIfolder
---inc
---system
----application
----and so on
---user_guide

so it was relative to my virtual directory set up on my httpd.conf.




Theme © iAndrew 2016 - Forum software by © MyBB