Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
croivo
- Posts: 111
- Joined: Wed Feb 26, 2014 11:02 pm
Post
by croivo » Sat Apr 25, 2015 5:49 pm
I'm having troubles trying to load images from internet. I use this code on a button:
Code: Select all
set the filename of image myImage to "http://mysite.com/myimage.png"
However, this doesn't load images every time. Also, how to save that image in the stack so that if I compile app with that image (set as source of image holder) it doesn't dissapear (if there is no internet connection)?
-
Klaus
- Posts: 14177
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Sun Apr 26, 2015 1:01 pm
Obviously "import paint from file..." only works with local files.
You need to do download the image to your machine first like this:
...
put url "
http://mysite.com/myimage.png" into url("binfile:" & speciafolderpath("documents") & "/myimage.png")
...
And use that new local file.
-
jacque
- VIP Livecode Opensource Backer

- Posts: 7389
- Joined: Sat Apr 08, 2006 8:31 pm
-
Contact:
Post
by jacque » Sun Apr 26, 2015 7:06 pm
This works to load an image from a web URL:
Code: Select all
set the text of img 1 to url "http://www.domain.com/images/img.png"
That will load the image content from the web directly into the image object. Since the the image is now imported rather than referenced, saving the stack will save the image as well.
I'm having troubles trying to load images from internet. I use this code on a button:
set the filename of image myImage to "
http://mysite.com/myimage.png"
However, this doesn't load images every time.
If this only fails some of the time, the most likely reason is an incorrect URL. You might get more information about the cause of the error if you check the result after issuing the command:
Code: Select all
set the filename of image myImage to "http://mysite.com/myimage.png"
if the result is not empty then answer the result
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
-
croivo
- Posts: 111
- Joined: Wed Feb 26, 2014 11:02 pm
Post
by croivo » Thu Apr 30, 2015 6:50 pm
Thanks Jacque! That's what I was looking for

-
croivo
- Posts: 111
- Joined: Wed Feb 26, 2014 11:02 pm
Post
by croivo » Thu Feb 25, 2016 11:41 pm
Just one more dumb question (I'll ask here so I don't open million new topics):
How do I set filename of image to other image?
Let's say I have imported image in stack and I want to set the filename of another image to be the same as the image that is imported?
-
dunbarx
- VIP Livecode Opensource Backer

- Posts: 10305
- Joined: Wed May 06, 2009 2:28 pm
Post
by dunbarx » Fri Feb 26, 2016 12:10 am
Hi.
Do you mean set the "filename"? See the dictionary.
Criaig Newman
-
jacque
- VIP Livecode Opensource Backer

- Posts: 7389
- Joined: Sat Apr 08, 2006 8:31 pm
-
Contact:
Post
by jacque » Fri Feb 26, 2016 5:53 am
croivo wrote:How do I set filename of image to other image?
Let's say I have imported image in stack and I want to set the filename of another image to be the same as the image that is imported?
The filename is only used to refer to a file on disk. If an image is already imported, it has no filename, it is now a part of the stack. The content of an image is its "text" property. So to put the content of an imported image into another image:
Code: Select all
set the text of img 2 to the text of img 1
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com