Welcome Guest, Not a member yet? Register   Sign In
Differences referencing image from localhost and server
#1

[eluser]Unknown[/eluser]
Hello all,

I just started using CI and am noticing a peculiarity referencing images. I hope somebody can help me out.

I'm referencing the image in /application/views/view_welcome.php:

If I use
Code:
/images/splash-logo.jpg
the image displays on the server, but not on my localhost.

If I use
Code:
images/splash-logo.jpg
it displays on localhost, but not on the server.

I have nothing in my .htaccess file.
$config['base_url'] = '';
$config['index_page'] = 'index.php';

Any ideas?
#2

[eluser]InsiteFX[/eluser]
Code:
<head>
    <base href="<?php echo base_url();?>" />
</head>

<body>
    images/splash-logo.jpg
</body>
#3

[eluser]Unknown[/eluser]
Thanks for replying, but I don't understand.

I'm referencing the image in a <div> like this:
Code:
background-image: url('/images/splash-logo.jpg');

If I use the '/' at the beginning it will display on the server, but not on my localhost.

If I don't use the '/' at the beginning it will display on my localhost, but not on the server.




Theme © iAndrew 2016 - Forum software by © MyBB