Broken images - displaying with dreaded red x

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
newnewbie
Forum Newbie
Posts: 2
Joined: Tue Mar 23, 2010 9:52 am

Broken images - displaying with dreaded red x

Post by newnewbie »

Like my id says....really new at this. My page is created with several "require"s. I bring in the header image from one php file, the navigation from another php file. The "required" file displays the images correctly. But, in the generated page, a red x is displayed where the images should be (but the alt text is displayed). As you can see I have used both relative and absolute paths with no luck. Here is the code for the generated page where the images do not display:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<?php
//$page_title = "Home";
$page_title = "Home";
?>
<title>
<?php
print $page_title;
?>
</title>
</head>

<body>

<?php
require_once("core/page_header.php");

require_once("c:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/my_starz/core/nav_menu.php");

?>

</body>
</html>

Here is the code from header.php which displays the header image correctly:

<div class="topOfpage" ><img src="../_img/header_imgs/header_img.gif" alt="Different Starz" name="imgHeader" width="800" height="169" border="0" usemap="#imgHeaderMap" id="imgHeader" />

<!--is map--->

<map name="imgHeaderMap" id="imgHeaderMap">
<area shape="rect" coords="715,138,778,166" href="../site/login/index.php" alt="Log In" />
</map>
</div>

Thanks for suggestions/corrections!
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Broken images - displaying with dreaded red x

Post by AbraCadaver »

The image path is relative to the main page, not the required one:

Code: Select all

<img src="_img/header_imgs/header_img.gif" alt="Different Starz" name="imgHeader" width="800" height="169" border="0" usemap="#imgHeaderMap" id="imgHeader" />
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
newnewbie
Forum Newbie
Posts: 2
Joined: Tue Mar 23, 2010 9:52 am

Re: Broken images - displaying with dreaded red x

Post by newnewbie »

WOW! Thank you so much for sharing your expertise! Obviously, it worked.
Post Reply