How to refresh an image on card when a new image is uploaded

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

How to refresh an image on card when a new image is uploaded

Post by alex298 » Tue Apr 28, 2009 6:01 am

Hello,

I have an image on a card. The image source is from a website, i.e.

set the filename of image "my_image" to "http://www.mydomain.com/images/scene.gif"

I also layout a "browse image" and "upload image" buttons on this card. Therefore users can upload a new image (scene.gif) to the website and replace with the old one.

I wish that the image on the card will be changed after the upload is finished. How can I do that? I don't wish to close the card and open it again.

I searched for "update image path" and "refresh image path" but no luck. I also tried to set the filename of image again at the end of the script after the upload but it does not work.

Please help.

Alex
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 Apr 28, 2009 8:18 am

Hi Alex,

This should work:

Code: Select all

put "http://www.mydomain.com/images/scene.gif" into myUrl
unload URL myUrl
lock screen
set the filename of img "My Image" to empty
set the filename of img "My Image" to myUrl
unlock screen
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 Apr 28, 2009 3:16 pm

Dear Mark,

Thanks. It works! You are really amazing:)

Best regards
Alex
Nice to meet all of you.

Post Reply