Welcome Guest, Not a member yet? Register   Sign In
loading images in browser
#1

[eluser]Unknown[/eluser]
I can't load my images from my root directory ,what is the problem ?
#2

[eluser]skunkbad[/eluser]
show some code, and we can probably help
#3

[eluser]Unknown[/eluser]
<img src="&lt;?=base_url()?&gt;?images/2.jpg" border="0" />
#4

[eluser]Zeeshan Rasool[/eluser]
I think there is an error in this code. You are using ( base_url()? )it like passing a param to a php page.

You should use ...

Code:
&lt;?=base_url()?&gt; images/2.jpg

OR (if you haven't any '/' in the end of baseURL ,then)

Code:
&lt;?=base_url()?&gt; / images/2.jpg
#5

[eluser]skunkbad[/eluser]
you probably need to output a surrounding image tag.

Code:
&lt;?php
echo '<img src="' . base_url() . 'images/2.jpg" alt="whatever" />';

//unless you really meant to have that question mark between your base url and 'images'. and if that is the case then do this:

echo '<img src="' . base_url() . '?images/2.jpg" alt="whatever" />';

//this assumes you have an image directory called 'images' that is located at root.
#6

[eluser]richthegeek[/eluser]
*drumroll*

Code:
&lt;?php echo site_url("/images/2.jpg"); ?&gt;

ta-da!
#7

[eluser]wiredesignz[/eluser]
Rich are you drunk?

Code:
&lt;?php echo site_url("/images/2.jpg"); ?&gt;  //produces: http://domain.tld/index.php/images/2.jpg

Its not even an image tag or a link. Tongue
#8

[eluser]richthegeek[/eluser]
lol, not drunk, just tired.

I always (always always always) have mod_rewrite going on so my site URL has no index.php in it.

And OP's question wasn't really about producing a tag, just a good URL.




Theme © iAndrew 2016 - Forum software by © MyBB