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_Hhighlighted_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
breeze351Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
I think this is an HTML file path issue, not a PHP problem.

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.
Chris StanyonWebDevCommented:
The double dots indicate the parent folder, so ../Autogen/Menu_Hhighlighted_1.gif will head up one folder from the html page, and then drop down into a folder called Autogen, so your structure would need to look like this.

Root
 |- AutoGen
       - Menu_Hhighlighted_1.gif
 | -HTML Files
       - yourPage.html

You haven't said where you page sits, so I can't help you with specifics. Show us your file structure and we'll sort it out for you :)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ludofulopCommented:
where in the directory structure is placed the (php/html) file that contains that html code ? Maybe src="./Autogen/Menu_Hhighlighted_1.gif"  should do it ?
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

Dave BaldwinFixer of ProblemsCommented:
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>

Open in new window

breeze351Author Commented:
That was it. The last site had a root where the subdirectory was.  I have to clean up this code.
Thanks
Glenn
Ray PaseurCommented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.