Re: Displaying graphics

M

marlonolram

Guest
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 (outdated link removed) - the source code is available to take a look at - any one have any ideas please???

Thanks
 
Joined
Jan 15, 2003
Messages
4
Reaction score
16
Points
3
Location
Whangarei, New Zealand
Your Mac's Specs
Pwnt
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.
 
Joined
Jun 11, 2003
Messages
4,915
Reaction score
68
Points
48
Location
Mount Vernon, WA
Your Mac's Specs
MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
muso said:
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!
 
OP
M

meerk

Guest
Murlyn said:
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…
 
Joined
Jun 11, 2003
Messages
4,915
Reaction score
68
Points
48
Location
Mount Vernon, WA
Your Mac's Specs
MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
meerk said:
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!
 
OP
M

meerk

Guest
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
 
Joined
Jun 11, 2003
Messages
4,915
Reaction score
68
Points
48
Location
Mount Vernon, WA
Your Mac's Specs
MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
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
 
Joined
Jan 15, 2003
Messages
4
Reaction score
16
Points
3
Location
Whangarei, New Zealand
Your Mac's Specs
Pwnt
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.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top