Replacing a distant image by a "built-in" one?

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

Post Reply
Zax
Posts: 519
Joined: Mon May 28, 2007 10:12 am
Contact:

Replacing a distant image by a "built-in" one?

Post by Zax » Sun Feb 06, 2022 12:42 pm

Hello,

I'm trying to display a distant image in a stack with:

Code: Select all

set the filename of image "poster" to "http://lainopik.on-rev.com/posterchild.jpg"
In my case, the image URL comes from a PHP script, designed to return empty if desired image is not found on the server.

If the PHP script returns a valid URL, all is working fine and the image is correctly displayed (its fileName contains the distant URL).
My problem is what to do if the PHP script returns empty: in this case, I would like to display a generic image a control located in my stack or in a substack (and not a local image file). How could I do that?
If I set the image's filename to empty, well the image is empty. I also tried to set its ID to the ID of the generic image, without success.

Thank you.

Klaus
Posts: 14193
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Replacing a distant image by a "built-in" one?

Post by Klaus » Sun Feb 06, 2022 12:57 pm

Hi Zax,

well, this is Livecode, you know?

Code: Select all

...
put img "another image" of cd 1 of stack "another stack" into img "poster"
...
:-)

Best

Klaus

Zax
Posts: 519
Joined: Mon May 28, 2007 10:12 am
Contact:

Re: Replacing a distant image by a "built-in" one?

Post by Zax » Sun Feb 06, 2022 1:22 pm

Klaus, I don't know if I have to hate you to make me feel so stupid... Or if I rather should love you to help me :mrgreen: :mrgreen: :mrgreen:

Anyway, thank you very much for your quick and valuable answer. :D

Klaus
Posts: 14193
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Replacing a distant image by a "built-in" one?

Post by Klaus » Sun Feb 06, 2022 2:03 pm

Do whatever you like, Zax! :-)

SparkOut
Posts: 2945
Joined: Sun Sep 23, 2007 4:58 pm

Re: Replacing a distant image by a "built-in" one?

Post by SparkOut » Sun Feb 06, 2022 9:41 pm

Don't hate the Hoff - or the Klausimausi !

Post Reply