XWidgetSoft Forum
https://www.bbs.xwidget.com/

Pulling chart images off the web
https://www.bbs.xwidget.com/viewtopic.php?f=8&t=3087
Page 1 of 1

Author:  mrrearden [ May 17th, 2013, 9:41 am ]
Post subject:  Pulling chart images off the web

Hello,

I am having a terrible time trying to get this to work and would very much appreciate any help.

I am trying to use xwidget to code my own widget to download a 640x480 gif image every minute or so and display it so I can move it around.

I am using two "image" components #1 I bind to photoalbumcore and set the image source to %FileName. #2 is just an underlay border (to border the chart image from below and make it look nice)

Then I use TimerCore set at a 60000ms update timer with:

function TimerCore1OnUpdate(Sender)
{
DownloadFile("my URL here","achart.gif", "")
}

My problem is that every time I start the widget I get the latest chart but it never updates the image. so I know that the photoalbumcore is passing the image to my "image1" component but it never refreshes.

PLEASE HELP ME!!!! :-(

Author:  mrrearden [ May 17th, 2013, 9:44 am ]
Post subject:  Re: Pulling chart images off the web

by the way, my photoalbumcore directory is set to widget directory and it grabs the "achart.gif" file from there correctly.

Author:  qiancang [ May 17th, 2013, 10:02 am ]
Post subject:  Re: Pulling chart images off the web

if you want to display gif, you need to use "gif" component, not "image" component.

Attachments:
gif.png
gif.png [ 13.55 KiB | Viewed 5704 times ]

Author:  mrrearden [ May 17th, 2013, 10:19 am ]
Post subject:  Re: Pulling chart images off the web

Thanks. It's not an animated gif, it's static and update by the site every minute.

will using the gif component cause the photoalbumcore to correctly pull the updated "achart.gif" file correctly?

Author:  KJags [ June 5th, 2013, 3:09 am ]
Post subject:  Re: Pulling chart images off the web

mrrearden wrote:
Hello,

I am having a terrible time trying to get this to work and would very much appreciate any help.

I am trying to use xwidget to code my own widget to download a 640x480 gif image every minute or so and display it so I can move it around.

I am using two "image" components #1 I bind to photoalbumcore and set the image source to %FileName. #2 is just an underlay border (to border the chart image from below and make it look nice)

Then I use TimerCore set at a 60000ms update timer with:

function TimerCore1OnUpdate(Sender)
{
DownloadFile("my URL here","achart.gif", "")
}

My problem is that every time I start the widget I get the latest chart but it never updates the image. so I know that the photoalbumcore is passing the image to my "image1" component but it never refreshes.

PLEASE HELP ME!!!! :-(



ok heres what i would do...i dont know if the best method but it works for me in a .png case.

Code:
var file = WidgetPath+"achart.gif";
var url = // whatever your url to the .gif is.

function TimerCore1OnUpdate(Sender){
    DownloadFile(url,file, "updateGif");
}

function updateGif(){
    Gif1.Src = "";
    Gif1.Src = file;
}


scrap the photoalbum core and image1 component and use the gif component as qiancang said.
as i said this is what i would do with a .png case im not sure if would work with .gif
i see this post is a bit aged so if u havent already gotten through good luck.

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/