Doctor Who
Doctor Who

Reputation: 1659

Why won't image in subdirectory show but will if I move it up a level?

I am just learning web development and am having a problem I just can't seem to fix.

I have images I want to display on a page, in my ftp they are in book/detailed_image

On my page I have the img src

<img src="/new/site/images/book/detailed_image/book_one_detailed_View.jpg">

I have checked multiple times and the source is correct. If I move the image up a directory to the book directory and change the src the images display correctly.

What could be the cause of this?

The file attributes of the book and detailed_image directories are the same has are the attributes of the image files.

Using firebug it says the url failed to load.

Upvotes: 2

Views: 4688

Answers (4)

Joe
Joe

Reputation: 1

I just solved the issue which I also had: it seems that the subdir "Images" has to have the same rights as the images contained therein. I changed the access rights for the folder to "755" and added to include all subdirs with the same rights, now it works! Hope it does the same for you...

Upvotes: 0

user3337052
user3337052

Reputation: 69

this probably isn't the case for you, but I had the same problem - I got a 404 not found error with the image in images/Paris/p1.png but if I moved the image into the images folder it displayed correctly....I fixed my issue by changing the name of the 'Paris' folder to 'paris' - I have no idea why but it worked...

Upvotes: 0

Rahul Raghavan
Rahul Raghavan

Reputation: 11

I think it is a problem with the permissions of the folder "detailed_image". If you do a chmod 755 detailed_image then it will work.

Upvotes: 1

JoeBobs
JoeBobs

Reputation: 764

If you have your html file in the same location as your new folder then there is no need to put a forward slash at the beginning of your url.

Change:

<img src="/new/site/images/book/detailed_image/book_one_detailed_View.jpg">

To:

<img src="new/site/images/book/detailed_image/book_one_detailed_View.jpg">

Upvotes: 1

Related Questions