Making images visible in php localhost
Invisible Images (.gif, .jpeg, .png)

I am using PHP from localhost. The files have extension .php. The content has images and text. However, only the text is displayed when I load them from http://localhost/file.php. A red X marks the location of the image.

If I change the extension from .php to .html and load the same file from file:///C:/inetpub/wwwroot/file.html, the image is visible. But it is not from localhost with .php.

when I change the header to image/gif, I see only the image not the text.

<HTML>

<HEAD>
<TITLE> </TITLE>

<META NAME="GENERATOR" Content="Microsoft Visual Studio">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=UTF-8">

<style type = "text/css">
p
{
font-weight: bold;
}

body
{
background-image: url("image1.gif"), no-repeat;
background-position: top right;
}
</style>
</head>

<body>
<p>
Images [gif, jpg, png] are not showing up from http://localhost from file with php extension as background or img src. <br /> <br />

All it shows is an X.
</p>

<img src="image1.gif" alt = "gif image" border = "1"/>
<br /> <br />
<img src="image001.jpg" alt = "jpg image"/>
<br /> <br />
<img src="image1.png" alt = "png image" border = "2" />
<br /> <br />

<?php
echo "Images not visible!";
?>
</body>
</html>


gd
GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.1.9
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled

    Hi,

    How are you loading these files? Through a standard browser? Or through your visual studio preview? Also: If in a normal browser you right-click the red x and choose view image what happens? If you check the location (right click: Copy image location) does that make sense?

    In principle it should notmake a difference whether it is a php or html page through which you are displaying the images.

    J.

      I am loading them now using PHP designer. From the preview tab I cannot see the gif but the jpeg and png show up.

      As for browsers, I am using firefox and IE. Nothing (gif, jpg, png) shows up on either of them.

      When I right-click on the X and select show picture, nothing happens.

      When I right-click of the 17 possible options, only 5 are available:
      Show pictures, Go to my pictures, copy, add to favorites, properties. The other 12 are disabled or gray.

      In principle, that is correct. However, now when I access the html file from this:
      file:///C:/inetpub/wwwroot/file.html
      it is fine.

      But, http://localhost/file.php does not display the images.

        Write a Reply...