0

I have a simple presenter when my PC is not compatible with a data projector. I make a print-screen of my local PC and upload it to my web page via FTP. It is working automatically, no problem (Linux).

But I would like to change following file to reload only when the program sees that the picture "web_presentation.png" has been changed (uploaded anew). The problem is that this page is constantly blinking while reloading every 10 s - it is annoying.

<html>
<head>
<title>web_presentation</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<meta Name="Keywords" Content="redirect">
<meta Name="description" Content="redirect">
<meta http-equiv="Refresh" content="10; URL=web_presentation.htm">
</head>
<BODY>
<img src=web_presentation.png width=100%>
</body>
</html>

This page is displayed on a second PC, which is connected to the data projector (usually windows).

I spend a few hours to figure out how to get modification time (lastmodified) of web_presentation.png and reload it according to this information.

If possible, please stick to pure javascript or php (Firefox). It seems to be much more difficult as I thought it would be.

Thanks :-)

xerostomus
  • 466
  • 4
  • 11
  • How do you know when the picture has been changed? – programmerRaj Sep 07 '21 at 21:09
  • I know it is somehow entangled. I suppose that it is possible to run time cycle in javascript to periodically check the pictures modification date, but reload picture only when the picture has been changed. Please correct if I am wrong. :-) My problem is that I cannot get the modification time of the picture. Or I can load some php file with this information. But I do not know how to get content of a php file into a javascript variable. – xerostomus Sep 09 '21 at 18:59
  • With javascript, you can periodically fetch the picture and update it, without even refreshing the page. Can you see https://stackoverflow.com/questions/1077041/refresh-image-with-a-new-one-at-the-same-url/9943419#9943419 and try it in a `setInterval`? – programmerRaj Sep 09 '21 at 20:24

0 Answers0