Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   HTML (http://www.velocityreviews.com/forums/f31-html.html)
-   -   Re: cannot execute img src in localhost (http://www.velocityreviews.com/forums/t954315-re-cannot-execute-img-src-in-localhost.html)

Jonathan N. Little 11-08-2012 01:46 AM

Re: cannot execute img src in localhost
 
Marty wrote:
> I have a web page that is webpage.php. It shows up fine in localhost
> (ubuntu) except for the graphics. The header image, which is an img src,
> shows the alt text and carves out a space for the image. But the image
> does not show.
>
> If I change the page to .html I can see everything in the browser. But, I
> cannot execute the .html page on local host at all.


PHP is server side scripting where it outputs html. It sounds like you
have invalid PHP code.

>
> I tried asking in a php group but they said this is really a problem with
> the html not functioning.


Probably not. If just changing the file extension to .html fixes your
problem then what your problem is most likely is that you are not
writing PHP code but HTML markup.

>
> Any suggestions?
>


Post the the source code.


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Jonathan N. Little 11-08-2012 04:20 AM

Re: cannot execute img src in localhost
 
Marty wrote:
> On Wed, 07 Nov 2012 20:46:21 -0500, Jonathan N. Little wrote:
>
>> Marty wrote:
>>> I have a web page that is webpage.php. It shows up fine in localhost
>>> (ubuntu) except for the graphics. The header image, which is an img
>>> src, shows the alt text and carves out a space for the image. But the
>>> image does not show.
>>>
>>> If I change the page to .html I can see everything in the browser. But,
>>> I cannot execute the .html page on local host at all.

>>
>> PHP is server side scripting where it outputs html. It sounds like you
>> have invalid PHP code.
>>
>>
>>> I tried asking in a php group but they said this is really a problem
>>> with the html not functioning.

>>
>> Probably not. If just changing the file extension to .html fixes your
>> problem then what your problem is most likely is that you are not
>> writing PHP code but HTML markup.
>>
>>
>>> Any suggestions?
>>>
>>>

>> Post the the source code.

>
> I can save it as .html or .php and the results are the same. I can see
> everything formatted perfectly and I can see the alt text as well as the
> placeholder for the image. But the image does not display.
>
> To simplify troubleshooting, I put the image and the source file in the
> same folder var/www. I use BlueFish editor and the preview or browser
> button is set up to display the file in LocalHost.
>
> I edited the source file to get rid of as much crap as possible and still
> maintain the problem section:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <title>My Title</title>
> <meta name="description" content="My Descsription">
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
> <meta name="msvalidate.01" content="5D6F360E7CD47C4B14275762DBC20BAA">
> <link href="mystyle.php" rel="stylesheet" type="text/css">
>
> </head>
> <body>
> <div align="center">
> <table class="black_tableoutline" bgcolor="#FFFFFF" width="960">
> <tbody>
>
> <tr style="height: 60px; text-align: center;">
> <th height="484" valign="top" width="83%">
> <p align="center">
> <img src="problemfile.jpg" alt="problem image" height="220"
> width="700">
> </p>
> <table align="center" bgcolor="#eef3f9" height="40"
> width="676" border="0">
> <tbody>
> <tr>
> <td class="style25" height="36" valign="top"
> width="601"><span
> class="gobanner">Some Text
> ..</span>. </td>
> <td class="style25" valign="top" width="150"><img
> src="orange_go_btn34.jpg"
> alt="" align="left" height="34" width="112"></td>
> </tr>
> </tbody>
> </table>
>
> </div>
> </body>
> </html>
>


Okay there is your answer. That is HTML markup not PHP code. PHP code
would be something like this:


<?php

$A_PHP_Variable="I am a variable";
$A_num=5;
$Double_Me=$A_num * 2;

echo "<p>Creating HTML with PHP and $A_num doubled is $Double_Me</p>";

?>



--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

se 11-08-2012 05:18 AM

Re: cannot execute img src in localhost
 

"Marty" <martyfl@aol.com> skrev i meddelelsen
news:509b1f50$0$58015$c3e8da3$9b4ff22a@news.astraw eb.com...
> On Wed, 07 Nov 2012 20:46:21 -0500, Jonathan N. Little wrote:
>
>> Marty wrote:
>>> I have a web page that is webpage.php. It shows up fine in localhost
>>> (ubuntu) except for the graphics. The header image, which is an img
>>> src, shows the alt text and carves out a space for the image. But the
>>> image does not show.
>>>
>>> If I change the page to .html I can see everything in the browser. But,
>>> I cannot execute the .html page on local host at all.

>>
>> PHP is server side scripting where it outputs html. It sounds like you
>> have invalid PHP code.
>>
>>
>>> I tried asking in a php group but they said this is really a problem
>>> with the html not functioning.

>>
>> Probably not. If just changing the file extension to .html fixes your
>> problem then what your problem is most likely is that you are not
>> writing PHP code but HTML markup.
>>
>>
>>> Any suggestions?
>>>
>>>

>> Post the the source code.

>
> I can save it as .html or .php and the results are the same. I can see
> everything formatted perfectly and I can see the alt text as well as the
> placeholder for the image. But the image does not display.
>
> To simplify troubleshooting, I put the image and the source file in the
> same folder var/www. I use BlueFish editor and the preview or browser
> button is set up to display the file in LocalHost.
>
> I edited the source file to get rid of as much crap as possible and still
> maintain the problem section:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <title>My Title</title>
> <meta name="description" content="My Descsription">
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
> <meta name="msvalidate.01" content="5D6F360E7CD47C4B14275762DBC20BAA">
> <link href="mystyle.php" rel="stylesheet" type="text/css">
>
> </head>
> <body>
> <div align="center">
> <table class="black_tableoutline" bgcolor="#FFFFFF" width="960">
> <tbody>
>
> <tr style="height: 60px; text-align: center;">
> <th height="484" valign="top" width="83%">
> <p align="center">
> <img src="problemfile.jpg" alt="problem image" height="220"
> width="700">
> </p>
> <table align="center" bgcolor="#eef3f9" height="40"
> width="676" border="0">
> <tbody>
> <tr>
> <td class="style25" height="36" valign="top"
> width="601"><span
> class="gobanner">Some Text
> ..</span>. </td>
> <td class="style25" valign="top" width="150"><img
> src="orange_go_btn34.jpg"
> alt="" align="left" height="34" width="112"></td>
> </tr>
> </tbody>
> </table>
>
> </div>
> </body>
> </html>


<link href="mystyle.php" rel="stylesheet" type="text/css">
A stylesheet must have the extention .css


Jukka K. Korpela 11-08-2012 07:07 AM

Re: cannot execute img src in localhost
 
2012-11-08 7:18, "se", using a forged address, wrote:

> <link href="mystyle.php" rel="stylesheet" type="text/css">
> A stylesheet must have the extention .css


Nonsense. As long as the HTTP headers specify Content-Type: text/css,
any conforming browser will treat the data as CSS.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Lewis 11-08-2012 07:28 AM

Re: cannot execute img src in localhost
 
In message <k7ffae$8of$1@dont-email.me>
se <se@no-one.here> wrote:

> <link href="mystyle.php" rel="stylesheet" type="text/css">
> A stylesheet must have the extention .css


What idiot told you that?

No, a stylesheet can have any name at all, and any (or no) extension.


--
For more than a thousand generations the Jedi were the guardians of
peace and justice in the galaxy. Before the dark times. Before the
Empire.

Tim Streater 11-08-2012 09:30 AM

Re: cannot execute img src in localhost
 
In article <509b1f50$0$58015$c3e8da3$9b4ff22a@news.astraweb.c om>,
Marty <martyfl@aol.com> wrote:

> >> I tried asking in a php group but they said this is really a problem
> >> with the html not functioning.


There is no php in what you have posted.

> I edited the source file to get rid of as much crap as possible and still
> maintain the problem section:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <title>My Title</title>
> <meta name="description" content="My Descsription">
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
> <meta name="msvalidate.01" content="5D6F360E7CD47C4B14275762DBC20BAA">
> <link href="mystyle.php" rel="stylesheet" type="text/css">
>
> </head>
> <body>
> <div align="center">
> <table class="black_tableoutline" bgcolor="#FFFFFF" width="960">
> <tbody>


This table and tbody are not closed.

> <tr style="height: 60px; text-align: center;">


This table row is not closed.

> <th height="484" valign="top" width="83%">


This th is not closed.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689

Denis McMahon 11-08-2012 12:18 PM

Re: cannot execute img src in localhost
 
On Thu, 08 Nov 2012 02:56:17 +0000, Marty wrote:

> I edited the source file to get rid of as much crap as possible and
> still maintain the problem section:


No you didn't. If the problem is displaying the image, then it should be
apparent in the following (and arguably the <p> and </p> could be
omnitted):

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>My Title</title>
</head>
<body>
<p>
<img src="problemfile.jpg" alt="problem image" height="220"
width="700">
</p>
</body>
</html>

As a general observation, if you use a content-type http pseudo header in
the document head, some people suggest that best practice is to place it
as the first element in the <head>, as it may require that the document
be re-parsed - the sooner the browser can make this decision the less
time it wastes parsing stuff that will become redundant when it starts
again.

Also - as an aside - in a "normal"[1] apache web server + php
configuration, if a file called something.php contains only html markup
and no <?php ... ?> code sections, the php processor will pass it
unaltered to the web server process for sending to the requesting client.

[1] every configuration is different, but there are some things that most
configurations will do the same way.

Rgds

Denis McMahon

Tim Streater 11-08-2012 04:15 PM

Re: cannot execute img src in localhost
 
In article <509bd4db$0$3987$c3e8da3$40d4fd75@news.astraweb.co m>,
Marty <martyfl@aol.com> wrote:

> Forget the code above. I see it has a lot of distracting elements. Here
> is an HTML file. The problem is the same. I cannot display the image in
> LocalHost. By the way, the same code will display properly on a browser.
> It just will not work with localhost. So, I do not think it is an html
> problem at all. Know of any newsgroups that could help with a localhost
> problem?
>
> Could it be the doctype statement?


I only ever do this:

<!DOCTYPE html>

as it's unclear to me why I'd do anything else.

> By the way, you most certainly can have a .php for a css file. Doing so
> enables you to do lot of other things as well. It works perfectly in a
> regular browser.
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <title>My Title</title>
> <meta name="description" content="My Descsription">
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


Missing </head> (not that it matters, most likely).

> <body>
> <img src="problemimage.jpg" alt="problem image"
> height="220" width="700">
> </body>
> </html>


It would help to know what you mean by "I cannot display the image in
LocalHost". Do you mean that you have the html file, and the problem
image, on for example your desktop and then double-click the html file?

Or are you running apache on your machine, with the image and html files
in the proper place so that you can put http://localhost/problem.html
into your browser?

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689

Jukka K. Korpela 11-08-2012 04:44 PM

Re: cannot execute img src in localhost
 
2012-11-08 18:15, Tim Streater wrote:

> Or are you running apache on your machine, with the image and html files
> in the proper place so that you can put http://localhost/problem.html
> into your browser?


That seems to be the natural interpretation. Now, we might conjecture
that the server software sends wrong information in HTTP headers. We
just need to hack into the OP's system to check that... wait a sec...

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Jonathan N. Little 11-08-2012 05:14 PM

Re: cannot execute img src in localhost
 
Marty wrote:
> Forget the code above. I see it has a lot of distracting elements. Here
> is an HTML file. The problem is the same. I cannot display the image in
> LocalHost. By the way, the same code will display properly on a browser.
> It just will not work with localhost. So, I do not think it is an html
> problem at all. Know of any newsgroups that could help with a localhost
> problem?



Wait a minute, by the above are you saying that it works if your view is
using your local filesystem but fails using the server? IOW

file:///var/www/thepage.html

works but

http://localhost/thepage.html

doesn't?

If so then that would point to a problem with your server configuration.
You need to check out your /etc/apache2/httpd.conf


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


All times are GMT. The time now is 10:44 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.