Forum Moderators: phranque

Message Too Old, No Replies

Images in a subdirectory?

         

mystery250

4:07 am on Apr 23, 2004 (gmt 0)

10+ Year Member



How would I make it so images were usable in a subdirectory? Currently I cannot even go to them once I upload em.

troels nybo nielsen

7:45 am on Apr 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, mystery250.

Might your problems have something to do with the setup of your server? I recently began using another hosting company with a completely different user interface and a few days ago I managed to get myself shut out of a directory because I inadvertantly had made it protected.

mystery250

3:22 pm on Apr 23, 2004 (gmt 0)

10+ Year Member



I doubt that is it. I think I just need to create a file path, or edit the .htaccess file to allow it or something, but I do not know how.

troels nybo nielsen

6:15 pm on Apr 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not sure what the symptom of your problem is. Are you simply not seing your images on those pages where they were supposed to be?

If it is the first time that you try having images in a directory it is quite easy to get confused about the correct path to the image. One way of solving that problem is to avoid relative paths and use absolute paths instead. Something like:

<img src="http://example.com/images/nice-picture.jpg" border="0" width="128" height="132" alt="Short descriptive text about picture">

If this suggestion is of no use please ask again. Perhaps we can even hope for help from more competent members. :)

mystery250

7:05 pm on Apr 23, 2004 (gmt 0)

10+ Year Member



Right now, I just have the index of all of the files etc showing, so it would be almost impossible to have the paths wrong.

blackhole

12:29 am on Apr 25, 2004 (gmt 0)

10+ Year Member



If the name of the folder is "images" you can write the link as follows:

<IMG SRC="images/picture.jpg" ALT="Your description">

Regards
Blackhole

mystery250

12:40 am on Apr 25, 2004 (gmt 0)

10+ Year Member



I don't even think there is an image path specified? do I need to create an images folder for the subdirectory? Sorry, i am a newbie...

vkaryl

1:02 am on Apr 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmm. Well, you might need to do a "back to basics" thing here....

--example.com (otherwise known as "root folder")
------html (here you store your pages as html/php files)
--------images (here you store your graphics)
----cgi-bin ("root level" folder for cgi/perl etc. scripts)
----admin ("root level" folder for various admin files)
----anon-ftp ("root level" folder upload/download by ftp)

Your site should have a similar structure at least at root level - each host setup varies in names and such, but what works works, so it's all pretty much interchangeable.

So you use an ftp client (like WS_FTP) to upload your html files (also might have .php, .asp, etc. extensions - in any case, the files that hold the markup for the site and its pages) to the "html" folder; and you upload your graphics to the "images" folder.

Within your html files themselves, you call the images (to cause them to display properly on the pages) by use of a path which looks something like this: <img src="images/graphic1.jpg"> In other words, anywhere you need an image to display, you need to include the relevant piece of markup for that image, so that browsers know where to get what you want to show on the page.

If that's still no help, say so and I'll see if I can rephrase it somewhat.

mystery250

1:45 am on Apr 25, 2004 (gmt 0)

10+ Year Member



Yes... I know that much... I am just trying to make it so I can link to an image in a subdirectory, say....images.<website>.com/images/picture.GIF... When I type in the corresponding address, I get a error page. Http 404 not found....

esllou

12:37 pm on Apr 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



are you sure you have uploaded the images to that directory? no case sensitive problems, etc, etc?

mystery250

4:55 pm on Apr 25, 2004 (gmt 0)

10+ Year Member



Yes, I am 100% sure of that.

ergophobe

7:36 pm on Apr 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You say you have it set up with no html index page, so that the directory index is just a list of files. You should be able to click on those files/sudirectories until you get to the images. Click on the image and it should come up.

If you don't see a link to your images dir or, within the images dir to the images themselves, then your assumptions about the path to those files is wrong.

If you do see the links in the spots you expect and you click on an image file and it says not found, it's probably a permissions thing (though it should not say not found, but rather access denied).

Tom

ergophobe

7:38 pm on Apr 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



PS, when you upload

- is it via FTP?

- are you sure that you are uploading to "site.com/public_html/images/" and not to "site.com/images/"?

Note that 'public_html' could also be named 'www', 'htdocs' etc etc.

Tom

mystery250

7:52 pm on Apr 25, 2004 (gmt 0)

10+ Year Member



PS, when you upload
- is it via FTP?

- are you sure that you are uploading to "site.com/public_html/images/" and not to "site.com/images/"?

Note that 'public_html' could also be named 'www', 'htdocs' etc etc.

Tom

Well, I am uploading them via ftp, yes...I am uploading them to site.com/public_html/<subdirectory name>/images

ergophobe

9:26 pm on Apr 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




images.<website>.com/images/picture.GIF

Do you have your server set up to map this subdomain to the /images directory? Otherwise you would need a path like

"http://website.com/subdir/images.GIF" or
"http://www.website.com/subdir/images.GIF"

I think this has come up already - on *nix systems, path names are case sensitive.

mystery250

9:32 pm on Apr 25, 2004 (gmt 0)

10+ Year Member



How could I check to see if I do?

mystery250

9:37 pm on Apr 25, 2004 (gmt 0)

10+ Year Member



In response to:

You say you have it set up with no html index page, so that the directory index is just a list of files. You should be able to click on those files/sudirectories until you get to the images. Click on the image and it should come up.
If you don't see a link to your images dir or, within the images dir to the images themselves, then your assumptions about the path to those files is wrong.

If you do see the links in the spots you expect and you click on an image file and it says not found, it's probably a permissions thing (though it should not say not found, but rather access denied).

Tom

Well, I click on the image in the index directory, it goes to it. However, I cannot go to that image with a link? [<subdomain>.<domain>.com...]
[<subdomain>.<domain>.com...]
Then is when it says not found.

vkaryl

9:43 pm on Apr 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do those .jpg files actually have the extension as ".jpeg"?

mystery250

9:50 pm on Apr 25, 2004 (gmt 0)

10+ Year Member



Actually, that was just an example of a link...The actual images are .gif

ergophobe

10:28 pm on Apr 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




Well, I click on the image in the index directory, it goes to it. However, I cannot go to that image with a link?

Is this exactly what you are doing:

- You navigate through your directory structure and you end up in a directory and you see a list of files that are in that directory, including some image files.

- You click on one of those image files and it opens.

- You look at the address bar of your browser when it's actually showing the image and you copy that path - [etc...]

- you paste that into a link in your page in an image tag <img src="http://etc/etc/etc.gif"> or a link to open the image in a new page by itself <a href="http://etc/etc/etc.gif">my fig</a>.

- it gives you a broken link or it says that it cannot find the file.

mystery250

1:20 am on Apr 26, 2004 (gmt 0)

10+ Year Member



- you paste that into a link in your page in an image tag <img src="http://etc/etc/etc.gif"> or a link to open the image in a new page by itself <a href="http://etc/etc/etc.gif">my fig</a>.

Actually, I post that link into a browser.....

ergophobe

2:45 pm on Apr 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What about the other questions?

When you click on the link in the directory index, the image opens or not?

mystery250

3:50 pm on Apr 26, 2004 (gmt 0)

10+ Year Member



Yes, when I click on the image, it does open.

ergophobe

4:09 pm on Apr 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Then you do *exactly* the following: when the image is open in your browser, it displays a link in the address bar, but if you copy that url and paste it into a new browser window it will not find the file?

That sounds like a rewrite issue where it's rewriting depending on the referrer.

Just to verify, though, the above *exactly* describes what's happening?

Tom

mystery250

4:34 pm on Apr 26, 2004 (gmt 0)

10+ Year Member



Seems like that is what is happening... It just won't find the file when I do that. :P

ergophobe

5:04 pm on Apr 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If it were a permissions thing, it should say access denied. Since it just isn't finding it, that makes it sound like there's some sort of rewrite or redirect in effect for empty referrer URIs (or any referrer other than the site itself or something).

Did you put something in place to prevent people hotlinking to your images?

Are you able to put a page on your site with a src link and have it come up or is the image broken?

Tom

mystery250

5:22 pm on Apr 26, 2004 (gmt 0)

10+ Year Member



I believe it does come up broken when I try to, and also, I do not have hotlinking enabled for that subdomain, so that shouldent be the problem.