Forum Discussion

agmark's avatar
agmark
Visitor
14 years ago

Refreshing Images

I'm grabbing some images from a URL and displaying them on a roImageCanvas, but when I grab the updated image with the same url the screen doesn't display the fresh image. All I've seen in the docs is the PurgeCachedImages() method, but I'm not able toget that to work. I'm using the CustomVideoPlayer as the structure of the channel and I'm displaying the images in the following code snippet.
m.canvas.AllowUpdates(false)
m.canvas.Clear()
m.canvas.purgecachedimages()
m.canvas.SetLayer(0, [
{ url: "http://my.images.com/image?ID_NOTATION=324977&HEIGHT=75&WIDTH=120&TIME_SPAN=1"
TargetRect: m.layout.image1
'CompositionMode: "Source_Over"
},

more images here etc

What's the solution to purge the images so new ones will display?
TIA
Mark

4 Replies

  • Images are cached based on the URL, so if you want to force an update, the easiest way is to add a random value to the querystring, so the URL changes.

    Pseudo-example...
    date = CreateObject("roDateTime")
    ...
    url: "http://my.images.com/image?ID_NOTATION=324977&HEIGHT=75&WIDTH=120&TIME_SPAN=1&nocache=" + date.AsSeconds().ToStr()
  • Hey thanks for that Endless! Works perfect and it's good to know.
    Mark
  • The work around solved the problem.

    However, I'm curious to know what "PurgeCachedImages()" is doing (or should be doing) .