Page 1 of 1

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

Posted: Sun Feb 06, 2022 12:42 pm
by Zax
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.

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

Posted: Sun Feb 06, 2022 12:57 pm
by Klaus
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

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

Posted: Sun Feb 06, 2022 1:22 pm
by Zax
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

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

Posted: Sun Feb 06, 2022 2:03 pm
by Klaus
Do whatever you like, Zax! :-)

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

Posted: Sun Feb 06, 2022 9:41 pm
by SparkOut
Don't hate the Hoff - or the Klausimausi !