Welcome Guest, Not a member yet? Register   Sign In
codeigniter image absolute path..
#1

[eluser]FlyingCat[/eluser]
I am a codeignite newbie and tried to add an image in my file under view folder.

I add

Code:
<img src="../images/myImage.jpg"></img>
to my service_view.php. All I can see is a broken link of a small icon.

however, if I change my path to

Code:
<img src="../../user_guide/images/myImage.jpg"></img>
I can see the image.

My file system is as follow:

Code:
application-
   view ->folder    (where service_view.php is located)
   images -> folder   (where myImage.jpg is located)

user_guide-
   images ->folder  ((where myImage.jpg is located))

Can anyone help me about this? Thanks a lot!
#2

[eluser]John_Betong_002[/eluser]
Make sure you have ./application/config/config.php $config['base_url'] set correctly.

Code:
<img src="&lt;?php echo base_url().APPPATH;?&gt;images/myImage.jpg"></img>

APPPATH is set in index.php
&nbsp;
&nbsp;
Welcome to the forum.
&nbsp;
#3

[eluser]FlyingCat[/eluser]
Thank you John. It solved my problem. Big Grin




Theme © iAndrew 2016 - Forum software by © MyBB