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

Using remote images
https://bbs.xwidget.com/viewtopic.php?f=8&t=3632
Page 1 of 1

Author:  digigamer [ October 14th, 2013, 5:42 am ]
Post subject:  Using remote images

Trying to use a remote image in an image control... Help needed. Anyone? Tried to use the download file but that didn't work.

Author:  Jimking [ October 14th, 2013, 10:17 am ]
Post subject:  Re: Using remote images

Could you pls be more clear DG? What exactly do you want to do...?

Author:  digigamer [ October 15th, 2013, 4:56 am ]
Post subject:  Re: Using remote images

Stuck with that flickr weather one...
I got the url of images from the server (something like : http://example.com/image.jpg). Now i have to download and display them in an image control. But the code for downloading "downloadfile()" is not working. So is there another way of downloading or displaying them?

Author:  Jimking [ October 15th, 2013, 6:39 am ]
Post subject:  Re: Using remote images

I see! I didn't realize that was for my request! :lol:
Come on guys help us with this..!

Author:  meme [ October 15th, 2013, 1:16 pm ]
Post subject:  Re: Using remote images

This seems to work, does it help ? (credit to KJags for similar post ;) )

var url = "http://blog.marketing.ai/wp-content/uploads/2013/04/Link.jpg"; // whatever your url is to the image.
var file = WidgetPath+"Link.jpg"; // save location and file name

function button1OnClick(Sender)
{
DownloadFile(url,file, "UpdateImage"); // run function after download
}

function UpdateImage()
{
image1.Src = "";
image1.Src = file; // update the image
}

Author:  digigamer [ October 16th, 2013, 6:06 pm ]
Post subject:  Re: Using remote images

Thanks meme... Looks like it will do the job. But isn't there any way to know whether the file was successfully downloaded?

Author:  meme [ October 16th, 2013, 9:33 pm ]
Post subject:  Re: Using remote images

Quote:
But isn't there any way to know whether the file was successfully downloaded?

Maybe, delete the file with
DeletFilesToRecycle(file,0);

then download the file
DownloadFile(url,file, "UpdateImage");

then in function UpdateImage() (because this seems to execute after the download is complete) check if the file exists with
FileExists(file);

If the file exists the download was successful.

Author:  digigamer [ October 16th, 2013, 11:41 pm ]
Post subject:  Re: Using remote images

Thanks a lot!

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