Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   Web Design and Hosting (http://www.mac-forums.com/forums/web-design-hosting/)
-   -   Re: Displaying graphics (http://www.mac-forums.com/forums/web-design-hosting/927-re-displaying-graphics.html)

marlonolram 07-11-2003 12:04 AM

Re: Displaying graphics
 
OK, I have developed a website on a PC but I have no access to a MAC to check the site out. Apparently, there are many graphics that are not being displyed for some reason (I am pretty much convinced it is something really simple like an incorrect path or something) but without access to a MAC, I can't check out what the problem is!!

The URL is www.theflood.com.au - the source code is available to take a look at - any one have any ideas please???

Thanks

muso 07-11-2003 04:46 AM

Some of your image tags are written with a path like this: \images\shimTrans01.gif

It should be images/shimTrans01.gif - macs, and unix based hosts use paths with foward slashes and no slash at the start. Windows looks as though it supports both, so that's where your problem is.

Murlyn 07-11-2003 11:39 AM

Quote:

Originally Posted by muso
Some of your image tags are written with a path like this: \images\shimTrans01.gif

It should be images/shimTrans01.gif - macs, and unix based hosts use paths with foward slashes and no slash at the start. Windows looks as though it supports both, so that's where your problem is.

Wait a minute.. no no, that's not true, yes you need to write your images with a forward slash / instead of a back slash \, but all web servers, windows, macs, unix etc can use the / in front all this says is to start in the web root directory, which is usually public_html or htdocs or some such, and then go into the images directory which is within the web root directory, then open up shimTrans01.gif. All web servers allow this syntax.

Cheers!

meerk 07-11-2003 12:15 PM

Quote:

Originally Posted by Murlyn
can use the / in front all this says is to start in the web root directory, which is usually public_html or htdocs or some such, and then go into the images directory which is within the web root directory, then open up shimTrans01.gif.

Not quite true unfortunately. You need to put in a couple of 'dots' before the first 'forward slash'

eg (from your code)
img src="\images\shimTrans01.gif"

…this should be
img src="../images/shimTrans01.gif"

This is assuming that both the 'page' and 'images' folders are in the same directory.
Hope this helps

meerk…

Murlyn 07-11-2003 01:41 PM

Quote:

Originally Posted by meerk
Not quite true unfortunately. You need to put in a couple of 'dots' before the first 'forward slash'

eg (from your code)
img src="\images\shimTrans01.gif"

…this should be
img src="../images/shimTrans01.gif"

This is assuming that both the 'page' and 'images' folders are in the same directory.
Hope this helps

meerk…

Actually a couple dots with a forward slash ../ means go back one directory, it does not mean go back to the web root.. so for instance if your directory structure was like this:

/public_html/forums/macforum/webdesign/

And you had an html document within the webdesign directory and you wanted to access an images directory within the macforum directory you could make your link three ways:

1) <img src="http://www.example.com/forums/macforum/images/test.gif" />
This is an absolute link

2) <img src="../images/test.gif" />
This is a relative link

3) <img src="/forums/macforum/images/test.gif" />
This also is a relative link

The first one takes the absolute link, finds the server, even though it's localhost and outputs your image.. this actually takes more time since it has to do a dns lookup, etc etc on the domain name.

The second knows that it is on the same server so does not have to do a dns lookup. and it says.. go back one directory "macforum" then within the "macforum" directory go into the "images" folder.. now if your images folder was in the "forums" directory you could do this <img src="../../images/test.gif" /> which means go back two directories then go into the images directory.

The third by using the first slash to go to the web server root, not the machine root this is done by the server software to prevent people from surfing through your file structure, then it says go to the macforum directory, then the images directory then show test.gif

Cheers!

meerk 07-11-2003 06:50 PM

You're right, but…
…I still think that it's something to do with those 'backslashes' and starting off the path with one of them??

Anyways it's late and I'm fed up marking-up our company's new site.

I'll take another look tomorrow and ponder…

meerk

Murlyn 07-11-2003 07:23 PM

I havent looked at his code yet.. so I guess I might as well do that and help him out :) At least he understands the way directory structure works now.

Ok he has only one problem.

Change
<img src="images\floodLogo02.jpg">

To
<img src="images/floodLogo02.jpg">

And your page will show up the way you want it :)

Cheers!

Rick

muso 07-13-2003 06:20 AM

While it is supported to add a '/' in front of any path, it is not general practice.

What you should do marlonolram (if this isn't your setup at the moment), is have all your html/php/xhtml files in one folder (normally your root directory) and inside the root directory have one folder named images. I find this is the easiest way to manage links. That way, any internal file links can just be linked to with their file name, and all images just have a "images/" before them.

Always use foward slashes, and remember to define a base uri if you're using relative links.


All times are GMT -4. The time now is 06:09 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.