SOLVED - putting image in image holder
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
SOLVED - putting image in image holder
I have a background image object called ImgBack
I placed a button and wrote the following script:
on mouseUp
put "C:\LiveCode Builds\CSUSA_Database23\white_water.jpg" in image ImgBack
end mouseUp
I want to be able to change the image object, ImgBack by pressing the button.
What is the correct syntax?
And yes, when I get a free moment, I will watch the videos Klaus keeps telling me to watch.
Thanks.
Mike
I placed a button and wrote the following script:
on mouseUp
put "C:\LiveCode Builds\CSUSA_Database23\white_water.jpg" in image ImgBack
end mouseUp
I want to be able to change the image object, ImgBack by pressing the button.
What is the correct syntax?
And yes, when I get a free moment, I will watch the videos Klaus keeps telling me to watch.
Thanks.
Mike
Last edited by admin12 on Mon Aug 01, 2011 6:48 am, edited 1 time in total.
Re: putting image in image holder
Hi Mike,
hints:
LiveCode internally ALWAYS uses the UNIX path delimiter -> SLASH -> /!
ALWAYS Quote NAMES/STRINGS!
two options:
1. "import" (the binary data of the) image into your stack:
...
put url("binfile:C:/LiveCode Builds/CSUSA_Database23/white_water.jpg") into image "ImgBack"
...
2. or just set the filename:
...
set the filename of img "imgBack" to "C:/LiveCode Builds/CSUSA_Database23/white_water.jpg"
...
Best
Klaus
hints:
LiveCode internally ALWAYS uses the UNIX path delimiter -> SLASH -> /!
ALWAYS Quote NAMES/STRINGS!
two options:
1. "import" (the binary data of the) image into your stack:
...
put url("binfile:C:/LiveCode Builds/CSUSA_Database23/white_water.jpg") into image "ImgBack"
...
2. or just set the filename:
...
set the filename of img "imgBack" to "C:/LiveCode Builds/CSUSA_Database23/white_water.jpg"
...
Best
Klaus
Re: putting image in image holder
Klaus,Klaus wrote:Hi Mike,
hints:
LiveCode internally ALWAYS uses the UNIX path delimiter -> SLASH -> /!
ALWAYS Quote NAMES/STRINGS!
two options:
1. "import" (the binary data of the) image into your stack:
...
put url("binfile:C:/LiveCode Builds/CSUSA_Database23/white_water.jpg") into image "ImgBack"
...
2. or just set the filename:
...
set the filename of img "imgBack" to "C:/LiveCode Builds/CSUSA_Database23/white_water.jpg"
...
Best
Klaus
Ok, so to go one step further, if I wanted someone to simply choose a image from their computer, how would I replace the absolute path with the more dynamic one?
Would it be something like this: set the filename of image to [variable passed after file browser]
I have to look up how to load an image - I know it's in the manual.
To throw another curveball, this is going to be a web app, so when someone chooses an image to load as background, how do I store it? I would rather store it locally since I want multiple users to be able to "skin" the background with any picture they want.
Thanks for your help. Every piece of knowledge gets me one step closer to proficiency.
Mike
Re: putting image in image holder
Hi Mike,
http://www.runrev.com/developers/lesson ... nferences/
But some "specialfolderpath" like "preference" should work there, too, so you can write your infos to that folder.
Best
Klaus
Exactly! As long that variable holds a valid pathname!admin12 wrote: Klaus,
Ok, so to go one step further, if I wanted someone to simply choose a image from their computer, how would I replace the absolute path with the more dynamic one?
Would it be something like this: set the filename of image to [variable passed after file browser]
You should also check (some of) these stacks:admin12 wrote: I have to look up how to load an image - I know it's in the manual.
http://www.runrev.com/developers/lesson ... nferences/
Oh, sorry, I don't have much experience with Relets.admin12 wrote:To throw another curveball, this is going to be a web app, so when someone chooses an image to load as background, how do I store it? I would rather store it locally since I want multiple users to be able to "skin" the background with any picture they want.
But some "specialfolderpath" like "preference" should work there, too, so you can write your infos to that folder.
Best
Klaus
Re: putting image in image holder
OK. I got it all working - thank you.
Now, another question.
When I load an image in and set the image lock - how can Live Code resize the image, but keep it's proprotions? Right now it stretches the image to fit in both directions. I want to lock the aspect ratio, but resize to the size of the image box (in this case, 140 x 140)
Also, I want to be able to store both the image and the smaller resized image for later retrieval. How would I do this?
Mike
Now, another question.
When I load an image in and set the image lock - how can Live Code resize the image, but keep it's proprotions? Right now it stretches the image to fit in both directions. I want to lock the aspect ratio, but resize to the size of the image box (in this case, 140 x 140)
Also, I want to be able to store both the image and the smaller resized image for later retrieval. How would I do this?
Mike
Re: putting image in image holder
Hi Mike,
remember your old school days? And the "rule of three"?
That's what you need to calculate here
Will check my archives for some code snippet.
Best
Klaus
remember your old school days? And the "rule of three"?
That's what you need to calculate here

Will check my archives for some code snippet.
Best
Klaus