Welcome Guest, Not a member yet? Register   Sign In
help displaying images
#1

[eluser]webdevguy32[/eluser]
I am calling an img src from:
/application/views/view_page

Here's the code I have tried:
Code:
<?php
                $image_properties = array(
                'src' => 'image/logo.gif',
                'class' => 'post_images',
                'width' => '200',
                'height' => '200',
                'rel' => 'lightbox'
                );

                echo img($image_properties);
            echo img('image/logo.gif');
echo br(5);
?>
<img src="&lt;?=base_url()?&gt;/image/logo.gif" />
<img src="&lt;?php echo site_url('/image/logo.gif'); ?&gt;" />
Here are the directory structures where I have tried placing the image = logo.gif
Code:
-application
-image / logo.gif

Code:
-application
-application / image / logo.gif

Code:
-application
-application / views / image / logo.gif
Here's my .htaccess
Code:
Options +FollowSymLinks
    RewriteEngine On

    RewriteCond %{REQUEST_URI} !-f
    RewriteCond %{REQUEST_URI} !-d
    RewriteCond %{REQUEST_URI} !-l
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

None have worked, all have displayed the image stub<broken image> and when I try going to the image uri, it 404's out.

Any help is much appreciated!
#2

[eluser]webdevguy32[/eluser]
Figured it out after three hours of research. Here's the NEW .htaccess. Hopefully this will help others having the same problem.
Code:
Options +FollowSymLinks
    RewriteEngine On

# The line below is what fixed the problem. I have the image folder in root,
# at the same level as CI /application
RewriteRule ^(image)($|/) - [L]

    RewriteCond %{REQUEST_URI} !-f
    RewriteCond %{REQUEST_URI} !-d
    RewriteCond %{REQUEST_URI} !-l
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
#3

[eluser]noideawhattotypehere[/eluser]
You didnt really need to change htaccess, seems like your base_url is configured in a wrong way. You didnt add trailing slash after it?
RewriteCond %{REQUEST_URI} !-f - wont rewrite if url is a file
RewriteCond %{REQUEST_URI} !-d - wont rewrite if url is a directory
#4

[eluser]webdevguy32[/eluser]
Thanks nodia. I didn't add a trailing slash after what? Thanks.
#5

[eluser]noideawhattotypehere[/eluser]
application>config>config.php find $config['base_url'] and check it
#6

[eluser]webdevguy32[/eluser]
I can, and have found it. But what change do you advise, or what SHOULD it be?
#7

[eluser]CroNiX[/eluser]
it should be "http://www.yoursite.com/" <-with slash at end




Theme © iAndrew 2016 - Forum software by © MyBB