tags:

views:

516

answers:

4

hi, im using this php file as a header in my site. my problem is that i have included an image but it is does not displayed what is the problem?? this is my code

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<h2><center><img src="../../../../Users/sermed/Desktop/Manar's New web site/Harbourheader.gif" /></center></h2>
<center><b><font color="#000000">You logged in as : <? echo "<font color=#000000>$user1</font>";?></b></center>
<hr width=500>
<center><a href="main.php" class=links><font color="#000000">Home</font></a> | <a href="yachts.php" class=links><font color="#000000">Yachts</font></a> | <a href="buy.php" class=links><font color="#000000">Buy</font></a> | <a href="ret.php" class=links><font color="#000000">View History</font></a> | <a href="report.php" class=links><font color="#000000">Report</font></a> | <a href="help.php" class=links><font color="#000000">Help</font></a> | <a href="logout.php" class=links><font color="#000000">Logout</font></a><center>
<hr width=750>

</body>
</html>
+3  A: 

The img src has to reference an URL where the image can be downloaded, not its path on your local disk.

David Schmitt
+1  A: 

You can't just access any file on the hard drive you want. If it is above the directory that is at the base of you WebServer (eg. localhost/ or mysite.com/) you cannot use .. to get higher into the file system. I am guessing that is what you problem is.

Adam Peck
A: 

It looks to me that you are using the path on your machine as opposed to the server path and that it is outside of your web root.

Move the image to an images directory within your website and reference it with an absolute path.

<img src="/images/Harbourheader.gif" />
Rob Prouse
A: 

Generally speaking, an img tag does not "include" an image in an HTML file. An img tag tells the browser to make another request to a server to get the file. It's all client-side, not server-side.

For that reason, the src must refer to a resource that is accessible to the browser. As others have said, it should be a URL. In examples where it doesn't look like a URL (e.g. /images/Harbourheader.gif) it's because the browser will prepend the same server name to get the img that it used to get the original page.

--
bmb

bmb