CodeIgniter Forums
CodeIgniter URLs: linking problem to images - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: CodeIgniter URLs: linking problem to images (/showthread.php?tid=30994)



CodeIgniter URLs: linking problem to images - El Forum - 06-02-2010

[eluser]iConTM[/eluser]
When I try to access a page by following url structure
the images on my site wont show.

http://www.mysite.com/controller/function

in this case no problem:
http://www.mysite.com/controller

Can someone help me out?


CodeIgniter URLs: linking problem to images - El Forum - 06-03-2010

[eluser]mi6crazyheart[/eluser]
Can u show u'r controller file codes..... ?


CodeIgniter URLs: linking problem to images - El Forum - 06-03-2010

[eluser]umefarooq[/eluser]
here is solution to your problem in two ways

Code:
first in html call base_url function your path will always to your image path
<img src="&lt;?=base_url()?&gt;/image_path/image.jpg" />

second method is to call CI html helper img() function it will work same as above code

&lt;? echo img("image_path/image.jpg")?&gt;

for more information read user guide


CodeIgniter URLs: linking problem to images - El Forum - 06-03-2010

[eluser]iConTM[/eluser]
Thank you. Works great Wink