Home > Archive > PHP SQL > November 2004 > insert PHP-clock-code / not working
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
insert PHP-clock-code / not working
|
|
| Jan K. 2004-11-29, 4:02 pm |
| I am trying to insert a PHP clock on my webpage, but it does not work.
The code I am using is from:
http://www.ftls.org/en/examples/php..._analog.php3#s6
I have uploaded my HTML file (clock.htm) and the clock.php from the website
above.
clock.htm has the following code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Clock</title>
</head>
<body>
<IMG SRC="clock.php?size=200" BORDER="1">
</body>
</html>
Both files (clock.htm and clock.php) are in the www-root directory of my
webserver (where the rest of the HTM-files are as well. My provider supports
PHP (5).
But, the only thing appearing (in IE 6.0) is a red cross (like a missing
image).
The properties for this missing image are:
http://www.mydomainblockedforthispu...ck.php?size=200
What might be the problem?
Jan K.
| |
| Hilarion 2004-11-29, 4:02 pm |
| >I am trying to insert a PHP clock on my webpage, but it does not work.
>
> The code I am using is from:
> http://www.ftls.org/en/examples/php..._analog.php3#s6
>
> [...]
>
> What might be the problem?
Do you have GD lib installed in your PHP (read about "phpinfo" function
if you do not know)?
Enter the URL to your copy of "clock.php" in your browser to check
if it's there and what eventual errors it displays (you may have to
comment out "header" line in "clock.php" and add "error_reporting(E_ALL);"
line at the top of the script). If the page is blank, then check
what source did the browser get.
You may also try to change IMG tag to:
<img src="clock.php/?size=200" border="1">
or:
<img src="clock.php/clock.gif?size=200" border="1">
Hilarion
| |
| Jan K. 2004-11-29, 4:02 pm |
| Hilarion wrote:
>
> Do you have GD lib installed in your PHP (read about "phpinfo"
> function if you do not know)?
Thanks a lot for your help.
Do I have to install it, or should I ask the hosting provider if it's
installed?
According to my hosting-provider's website, the installed PHP-version is PHP
versie 4.3.8.
I have read somewhere on the internet that Php 4.3.0 and greater have the GD
libs already built in.
> Enter the URL to your copy of "clock.php" in your browser to check
> if it's there and what eventual errors it displays
Thanks for the tip, this leads me to an error message:
PHP Fatal error: Call to undefined function: imagegif() in
E:\mydomainblockedforthispurpose.com\wwwroot\clock.php on line 66
On line 66 in this PHP-file, I find the following code ->>>>>>
ImageGif($img);
Where the E:\ in the errormessage comes from/ I have no idea, but I suspect
the provider to have my website on their E:\drive ? I am not working on any
E:\ drive at all at home, so that cannot be it.
> Hilarion
Thanks for your support, do you have any clue what I should do now?
Jan K.
| |
| Hilarion 2004-11-29, 4:02 pm |
| > Thanks for the tip, this leads me to an error message:
>
> PHP Fatal error: Call to undefined function: imagegif() in E:\mydomainblockedforthispurpose.com\wwwroot\clock.php on line 66
I'm not sure but I think that GIF format support was withdrawn
from some GD versions cause of some GIF license issue.
You may try to change "imagegif" function execution in "clock.php"
to "imagepng" or "imagejpeg" (you'll have to change "header"
function parameter to "Content-Type: image/png" or "Content-Type:
image/jpeg").
Hilarion
| |
| Jan K. 2004-11-29, 4:02 pm |
| Hilarion wrote:
>
> I'm not sure but I think that GIF format support was withdrawn
> from some GD versions cause of some GIF license issue.
> You may try to change "imagegif" function execution in "clock.php"
> to "imagepng" or "imagejpeg" (you'll have to change "header"
> function parameter to "Content-Type: image/png" or "Content-Type:
> image/jpeg").
>
> Hilarion
Thanks again! and it worked!
Strange thing is that the clock is not 'ticking', (it's a still) but I'll
try to sort that out myself :-)
I am a complete newbie on PHP, so this would have taken some days to find
out that GIF/JPEG issue, if I would ever ...
Thanks for helping me out, now I can start changing the code, and see how
this PHP works.
Jan K.
| |
| Hilarion 2004-11-29, 4:02 pm |
| > Strange thing is that the clock is not 'ticking', (it's a still)
It's not ticking because the code generates image (jpeg) of
a clock (showing current server time).
You could make browser refresh the image (there could be some
problems with browser, server or proxy caching), which I do not
suggest.
You can replace your image with some client-side script
which renders the clock.
Hilarion
| |
| Jan K. 2004-11-29, 4:02 pm |
| Hilarion wrote:
>
> It's not ticking because the code generates image (jpeg) of
> a clock (showing current server time).
> You could make browser refresh the image (there could be some
> problems with browser, server or proxy caching), which I do not
> suggest.
> You can replace your image with some client-side script
> which renders the clock.
>
> Hilarion
I've removed the 'seconds' line, so it looks like a neat clock now, just
diplaying the hours + minutes.
No need for it to tick. I am quite happy with my first clock :-)
The next thing I'll try is to make two adjacent clocks on my page (managed
that), but one displaying Dutch time, one displaying Australian (Perth)
time. I am going to live in Australia, that's why I 'need' these clocks on
my webpage.
PHP is not very difficult to understand, I find lots of explanations on the
web, and it seems any code is quite easy to understand and edit. Thank for
helping!
Jan K.
| |
| Jan K. 2004-11-29, 8:56 pm |
| Jan K. wrote:
<solved>
But now I am so curious if the time on the webpage is my computertime, or
the time of my webhoster/server.
Could somebody please (not in GMT +1) check if the times on the two clocks
on the webpage are correct?
Amsterdam/Perth should be 7 hrs difference.
http://tinyurl.com/69223
If not correct, could someone help me getting user UTC-offset (or just
applying fixed UTC values to time?)
thanks,
Jan K.
|
|
|
|
|