Jump to content

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


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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.