G Web Development Software

annuler
Affichage des résultats de 
Rechercher plutôt 
Vouliez-vous dire : 

How to refresh URL Image?

Hello,

 

I have a program that puts an image on a website.

Every minute a new photo is taken, which updates that image on the website. 

I use a URL image to display this image in gWeb.

 

This works so far, but:

How can I update the shown Picture in the "URL image" Container in gWeb?

Here I only see the photo from the start.

 

Patrick_321_0-1695319950722.pngPatrick_321_1-1695319978816.png

 

 

0 Compliments
Message 1 sur 4
3 710 Visites

Hi Patrick_321,

 

What is likely happening is that the browser is caching the image at that URL. If you write the same URL to the image repeatedly, if the image is already in the cache then it won't be updated.

 

It depends on your server if it is safe to do but a common way to modify the URL and trigger a new download is to add a random number as a search parameter.

 

For example, for the url http://example.com:8080/Picture.png  you may add a search parameter like http://example.com:8080/Picture.png?_=1234  for example. In that example the search parameter name that was added is _ and the value is a number generated randomly, in this case 1234. As long as adding a search parameter with a random number to the URL does not cause issues with the server that can be a common approach.

 

Another behavior you are likely to run into is that when changing the URL the image will be cleared immediately until the new image loads. This can cause an undesirable flicker depending on how fast the image is updated. The Synchronous Image for WebVI example gives you a new image control where you can control the updates more precisely. You can use that library to only update the image after a new one has loaded.


Milan
Message 2 sur 4
3 677 Visites

works thanks also the  Synchronous Image for WebVI  😘

 

But only on my iphone, not on chrome or android handys

What the problem could be, no idea.

 

0 Compliments
Message 3 sur 4
3 617 Visites

@Patrick_321 wrote:

works thanks also the  Synchronous Image for WebVI  😘

 

But only on my iphone, not on chrome or android handys

What the problem could be, no idea.

 


Oh interesting, not sure. On an up to date Android Pixel 4a running Chrome 117 the Synchronous Image Demo Page seems to run correctly.


Milan
0 Compliments
Message 4 sur 4
3 600 Visites