Jump to content

[SOLVED] Can't get an image generated in PHP to auto-refresh.


kratsg

Recommended Posts

clock.php?font=1&timezone=EST&color=8B008B&or=FF7F50&ir=000000&cc=BDB76B&hhc=000000&mhc=000000&shc=000000&scd=F0F8FF

 

In the code for the clock creation:

 

<?php
header ("Refresh: 1; URL=$page");
header('Content-type: image/png');
imagePNG ($im); 
imageDestroy ($im); 

?>

 

$page is a variable that contains the URL to refresh the clock (with correct settings). Is there ANY way to get it to refresh via PHP WITHOUT using any client-side coding such as JavaScript?

 

It all works, except for it autorefreshing o_o

Nope. You can't get it to keep running (refreshing) w/out client constantly sending a request.  You could make a cronjob to constantly execute it but that's not really relevant to your problem...

 

edit:

 

And on that note, I would suggest you consider putting even more of it onto the client.  Like for instance, making a swf that does the same thing and just imbedding it.

and anyways, what's wrong with resorting to flash? Your clock would look cleaner, since it's vector based, and it puts the processing load onto the client instead of the server, and it keeps your script from constantly requesting the server...

If we ignore that what you are doing is probably the worst way to accomplish this -

 

In your existing code, the refresh header would need to be on the HTML page that contains the <img src="..." alt=""> tag that lists your php generated image.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.