Any good method to put image from Internet to RR stack?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
alex298
Posts: 101
Joined: Mon May 01, 2006 1:17 pm

Any good method to put image from Internet to RR stack?

Post by alex298 » Tue May 29, 2007 8:51 am

Hi,

I use the following to load a graph image from my website:

put "http://www.myweb.com/pic/graph.png" into tImageURL
put URL tImageURL into image "Graph"

The graph size is only 13 KB and load very fast in browser, usually within a second. However it always fail to load into my RR project. It seems that RR get the image much much slower than browser.

Any methods to ensure getting the image and faster?

Actually I tried a stupid method to get the image as below:

put "http://www.myweb.com/pic/graph.png" into tImageURL
Repeat for 3 times
put URL tImageURL into image "Graph"
if the size of image "Graph" = 0 then
wait 1.5 seconds
else
exit repeat
end if
End Repeat

However the graph is still always fail to load into image "graph".

Please help.

Thanks and best regards
Alex
Nice to meet all of you.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Tue May 29, 2007 12:03 pm

Hi Alex,

What is the problem? Does the image load slowly, but it appears eventually? Or doesn't it appear at all?

You might want to set the text of the image object to URL <url>. For example:

set the text of img 1 to url "http://forums.runrev.com/phpBB2/templat ... _phpBB.gif"

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

alex298
Posts: 101
Joined: Mon May 01, 2006 1:17 pm

Post by alex298 » Tue May 29, 2007 3:05 pm

Hi Mark,

Thanks for your help.

The problem is:
If the image does not load in the first second, it never appear. That's why I tried to load the image for three times.

Best regards
Alex
Nice to meet all of you.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Tue May 29, 2007 8:54 pm

Alex,

Are you sure that it is the downloading that takes time? Perhaps you should do it in two steps. First download the picture and then set the text of the image.

Code: Select all

put the millisecs into myTime
repeat 3
  put url "http://forums.runrev.com/phpBB2/templates/subSilver/images/logo_phpBB.gif"  into myImage
  if the result is empty then exit repeat
end repeat
put myTime & cr & (the millisecs - myTime) & cr
put the millisecs into myTime
set the text of img 1 to myImage
put the millisecs - myTime after msg
The message box will show you the time in milliseconds, the time needed to finish the repeat loop and the time to set the imagedata. Which part takes the most time?

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

alex298
Posts: 101
Joined: Mon May 01, 2006 1:17 pm

Post by alex298 » Wed May 30, 2007 4:03 am

Hi Mark,

It works very fast for thel ogo_phpBB.gif. The times are:
*****************
1180234342763
47
3
*****************

However when I wish to load the .png image from a website. The image sometimes appear and sometimes do not appear. The times when appear are:
*******************
1180234751145
136
18
*******************
and
*******************
1180234897096
231
17
*******************

The time when not appear are:
*******************
1180234503479
172
0
*******************
and
*******************
1180234862061
235
2
*******************

Any idea why this happens? The website is working normally.

Best regards
Alex
Nice to meet all of you.

Post Reply