Your Digital Media Has Never Looked So Good

 
agmark
Topic Author
Posts: 142
Joined: Thu Nov 10, 2011 8:29 am

Refreshing Images

Mon Jan 23, 2012 10:51 am

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
 
User avatar
TheEndless
** Valued Community Member **
Posts: 9231
Joined: Mon Oct 04, 2004 10:15 am
Location: US
Contact:

Re: Refreshing Images

Mon Jan 23, 2012 11:01 am

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()
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
 
agmark
Topic Author
Posts: 142
Joined: Thu Nov 10, 2011 8:29 am

Re: Refreshing Images

Mon Jan 23, 2012 1:22 pm

Hey thanks for that Endless! Works perfect and it's good to know.
Mark
 
buenafe
Posts: 70
Joined: Tue Mar 29, 2011 4:44 pm
Location: USA
Contact:

PurgeCachedImages

Thu Apr 05, 2012 10:23 am

The work around solved the problem.

However, I'm curious to know what "PurgeCachedImages()" is doing (or should be doing) .
----------------------------------------------------------------------------------
current: two roku XDS 2xs, dtvpal, boxeebox, kylo.tv,
radar: wdlxtv.com
 
Trevor
Posts: 31
Joined: Tue Mar 13, 2012 2:51 am
Location: CA, USA
Contact:

Re: Refreshing Images

Thu Apr 05, 2012 1:07 pm

From http://sdkdocs.roku.com/display/sdkdoc42/ifImageCanvas
PurgeCachedImages: This is a convenience method that will purge the internal cache of all images related to urls in the current content list. If the content list is empty, then this method will do nothing.
*** Trevor Anderson - bloggingwordpress.com - moviemavericks.com ***

Who is online

Users browsing this forum: No registered users and 6 guests