Welcome Guest, Not a member yet? Register   Sign In
Problems viewing Images. [resolved]
#1

[eluser]ATomkins[/eluser]
Hi, this should be a pretty simple problem, but i cant get around it.

At first I was having problems using a CSS sheet with my views, and I have just got round this, but none of the css images are shown (so I assume it cant find them).

I also cannot see images from the view itself, using the code:
<img src="&lt;?php echo base_url(); ?&gt;images/pic_1.jpg" width="231" height="301" alt="Pic 1" />

They images are in a seperate image folder in the root. I cannot even see them if i derectly lick to them in a browser(But they are deffinatly there!), this is the same with the css file, although that is being used.

I just keep getting:
404 Page Not Found

The page you requested was not found.

Can anyone help me with this?

Thanks alot

adam
#2

[eluser]Dam1an[/eluser]
Are you using a .htaccess file? You need to make sure the images aren't being routed via CIs index.php
Also, you could try using the img() function in the HTML helper
#3

[eluser]TheFuzzy0ne[/eluser]
To expand on what Dam1an said, you should try using the images URL in your browser's address bar, and troubleshoot from there.
#4

[eluser]ATomkins[/eluser]
As im just starting out, i havent had a chance to get to know what the hta access file is?
I had my suspicions it was being rerouted. Do you know how I can stop this?

Thanks for the quik reply too!
#5

[eluser]Dam1an[/eluser]
[quote author="TheFuzzy0ne" date="1244234367"]To expand on what Dam1an said, you should try using the images URL in your browser's address bar, and troubleshoot from there.[/quote]

I think thats what he tried when he said
Quote:I cannot even see them if i derectly lick to them in a browser(But they are deffinatly there!)
#6

[eluser]Dam1an[/eluser]
If you don't know what it is, then I assume you don't use it so that can't be the cause of the problem

The htaccess file lets you remove the index.php from the URL by routing all requests to be via index.php (which is transparent to the end user)

Code:
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico|license.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

As you can see in the rewrite condition, it passes anything that isn't an image, css, js etc onto the index.php
#7

[eluser]ATomkins[/eluser]
Great! Thanks for that!

your doing a great job

Adam
#8

[eluser]Dam1an[/eluser]
So was it the img function or the htaccess file that fixed it? (or both)
#9

[eluser]TheFuzzy0ne[/eluser]
Sorry, I clearly didn't read the original post as thoroughly as I thought - either that, or Alzheimer's is setting in a bit earlier than I'd hoped. It's probably the latter...

Could this be a problem with strange characters in your file names, or a problem with case-sensitivity? Please could you give an example of the filename, with the full request path, that you're trying to call?
#10

[eluser]ATomkins[/eluser]
I created the htaccess file and it all workes smoothly now.
I figured i'd eventually have to use one anyway to get rid of the index.php I think.

Thanks for your help




Theme © iAndrew 2016 - Forum software by © MyBB