XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 10th, 2025, 10:57 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Load image from web
PostPosted: August 9th, 2012, 9:41 am 
Offline

Joined: August 9th, 2012, 9:33 am
Posts: 2
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.


Top
 Profile  
 
 Post subject: Re: Load image from web
PostPosted: August 9th, 2012, 6:50 pm 
Offline
User avatar

Joined: May 12th, 2012, 8:32 pm
Posts: 594
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

_________________
XWidget Software Developer
[XWidget for Android] [Lastest version of XWidget] [Lastest patch of XWidget]
[XDesktop for Android/Windows]


Top
 Profile  
 
 Post subject: Re: Load image from web
PostPosted: August 10th, 2012, 5:37 am 
Offline

Joined: August 9th, 2012, 9:33 am
Posts: 2
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... ^^


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 20 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Powered by phpBB® Forum Software © phpBB Group