breeze351
asked on
Syntax for opening an image in PHP
I'm trying to display a gif for a menu. This is the same type of problem that I had with the new server. This code worked on the old one.
<a href="./index.php" class="nof-navButtonAnchor "><img id="NavigationButton1" name="NavigationButton1" height="21" width="137" src="../Autogen/Menu_Hhigh lighted_1. gif" border="0" alt="Menu" title="Menu"/></a>
If I copy the file "Menu_Hhilghted_1.gif" to the root and mod the code to rellect that it works.
The directory structure is:
Lansco
-->Autogen
<a href="./index.php" class="nof-navButtonAnchor
If I copy the file "Menu_Hhilghted_1.gif" to the root and mod the code to rellect that it works.
The directory structure is:
Lansco
-->Autogen
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
where in the directory structure is placed the (php/html) file that contains that html code ? Maybe src="./Autogen/Menu_Hhighl ighted_1.g if" should do it ?
If I was me, I'd do it this way. The single '/' indicates that the file and directory are relative to the root. I figure if I have to use all those dots, I'm doing something wrong.
<a href="/index.php" class="nof-navButtonAnchor"><img id="NavigationButton1" name="NavigationButton1" height="21" width="137" src="/Autogen/Menu_Hhighlighted_1.gif" border="0" alt="Menu" title="Menu"/></a>
ASKER
That was it. The last site had a root where the subdirectory was. I have to clean up this code.
Thanks
Glenn
Thanks
Glenn
This hint can make your life easier :-)
You can use a slash as the first character of the link, and it will be resolved relative to the web root of the host. So if you know your directory structure that might be an easy way to find the image.
Looks like a different directory structure from the old server. One way to fix this problem is to use fully qualified absolute URLs. They don't break. Another is to analyze the new directory structure, find out where image resources are located (relative to the URL of the document that is having the problem) and write a relative link that works for the new directory structure.
You can use a slash as the first character of the link, and it will be resolved relative to the web root of the host. So if you know your directory structure that might be an easy way to find the image.