G Web Development Software

cancel
Showing results for 
Search instead for 
Did you mean: 

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 Kudos
Message 1 of 4
(2,038 Views)

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 of 4
(2,005 Views)

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 Kudos
Message 3 of 4
(1,945 Views)

@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 Kudos
Message 4 of 4
(1,928 Views)