XWidgetSoft Forum https://www.bbs.xwidget.com/ |
|
Load image from web https://www.bbs.xwidget.com/viewtopic.php?f=8&t=1966 |
Page 1 of 1 |
Author: | klischee [ August 9th, 2012, 9:41 am ] |
Post subject: | Load image from web |
Hi! Is there the possibility to add images from an web url (best with update frequence parameter)? I want to display and update this animated GIF in a widget. |
Author: | Tony [ August 9th, 2012, 6:50 pm ] |
Post subject: | Re: Load image from web |
Hi, you can uses script code "DownloadFile" to get this gif image for excample, this bing widget can download the wallpaper file from url and display: http://www.xwidget.com/xwidget/widgets/ ... 8/240.html |
Author: | klischee [ August 10th, 2012, 5:37 am ] |
Post subject: | Re: Load image from web |
Thanks! Sadly I can't script but I looked into your linked widget and with some trial and error I cropped the code to this: Code: var filename = widgetpath + "radar.gif"; var url = "http://www.meteogroup.co.uk/meteo/automatic-gif/radar.teaser/radar_de_teaser.gif"; function DownLoadInit() { text_update.text = "Updating..."; text_update.visible = true; downloadFile( url,filename,"DownLoaded"); } function DownLoaded(succeed,filename,filesize) { text_update.visible = !succeed; if( succeed ) { gif_radar.src = ""; gif_radar.src = filename; } else { text_update.Text = "Update Failed!"; settimeout( "h",3000 ); } } This works nice, the image gets loaded from the url and displayed in the widget. Now I have to find out how to handle the saved gif-file (as xwidget does not overwrite it) and how to update the image every x min... ^^ |
Page 1 of 1 | All times are UTC - 8 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |