file name and image source
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
file name and image source
Hi all,
I wonder how to figure out the name of image source of the image "show" below
There are two ways to change images with my options.
1. set filename of image "show" to "/source_1.png"
2. put image "source_1.png" into image "show"
with method #1, the filename of image "show" indicates "source_1.png" as a name of image source, but with method #2, there is no indicator of image source.
Can I find out an original image name with method #2 ?
Cheers,
Louis
I wonder how to figure out the name of image source of the image "show" below
There are two ways to change images with my options.
1. set filename of image "show" to "/source_1.png"
2. put image "source_1.png" into image "show"
with method #1, the filename of image "show" indicates "source_1.png" as a name of image source, but with method #2, there is no indicator of image source.
Can I find out an original image name with method #2 ?
Cheers,
Louis
Last edited by Jellobus on Thu Dec 18, 2014 3:44 am, edited 1 time in total.
Re: file name and image source
Hey there Jellobus, with method 1 there is only a referense to the link of the image, no actual data are being imported into livecode, with method 2 the data are being imported into livecode and in your image(show in this case) so there is no need for for image source.
Knowledge is meant to be shared.
Re: file name and image source
Hi zaxos,
sorry for the unclear explanation. let's say its not file name but it's an original image source name.
with setting filename #1, you can see the root of the original image but with #2 you can't find out where the original image came from. you know what I am talking about?
Cheers,
Louis
sorry for the unclear explanation. let's say its not file name but it's an original image source name.
with setting filename #1, you can see the root of the original image but with #2 you can't find out where the original image came from. you know what I am talking about?

Cheers,
Louis
Re: file name and image source
well with method 1 you can see the the source beacoz you need you have linked your image with that source, if for example you:
and then you move image test.jpg away from "C:\" the image in livecode wont work anymore beacoz it is linked with an image "C:\test.jpg" that dosent exist anymore...
You need to understand the difference betwen these 2, in case 1 you use an external image , in case 2 you import the image in your stack wich in return is stored along with your program.exe when you compile it.
If you already understand this then my guess is that you want to be able to know the source of your image anyway so since livecode dose not keep a record of where the image came from, you should. here is a quick example, you save the link of the image inside a custom property of the imported image
this will store the link of the image inside a custom property of image "Show"
and this will show you what is inside that custom property
Code: Select all
set the filename of img "Show" to "C:\test.jpg"
You need to understand the difference betwen these 2, in case 1 you use an external image , in case 2 you import the image in your stack wich in return is stored along with your program.exe when you compile it.
If you already understand this then my guess is that you want to be able to know the source of your image anyway so since livecode dose not keep a record of where the image came from, you should. here is a quick example, you save the link of the image inside a custom property of the imported image
Code: Select all
put "C:\source_1.png" into theImage
put img theImage into image "show"
set the imageSource of img "show" to theImage
Code: Select all
put the ImageSource of img "show"
Knowledge is meant to be shared.
Re: file name and image source
Hi zaxos,
Thanks for the detailed explanation.
The main reason I want to include all images into the stack is to hide files. whenever I saved as standalone application for the desktop(window) environment, the copy files is created into the folder where the main app stack created. users can open the file folders... I don't want to users see the image files of the app directly. Do you know how to hide copy files without importing them into the stack?
Thanks a lot in advance,
Louis
Thanks for the detailed explanation.

Thanks a lot in advance,
Louis
Re: file name and image source
Hi Louis,
Just for a test I imported 2 images on to card 3 of my stack then ran this on card 1
And it returned the correct target.
Does that answer it for you?
Simon
Just for a test I imported 2 images on to card 3 of my stack then ran this on card 1
Code: Select all
on mouseUp
put the name of img 2 of cd 3
end mouseUp
Does that answer it for you?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: file name and image source
Hi Louis,
to answer your original question:
If you IMPORT an image file into your stack then there is NO reference to the original image file anymore.
You can even delete the original file, that does not affect the imported image.
So no, you cannot find out what and where the original image has been after importing!
But instead of using the images directly you can always use a BUTTON and set its ICON property to display different images dynamically!
That's what I do most of the time
@Zaxos
BEWARE: "imagesource" is a reserverd word!
Add a little c (for Custom property) in front of it and it will work -> the cImageSource of xyz
Best
Klaus
to answer your original question:
If you IMPORT an image file into your stack then there is NO reference to the original image file anymore.
You can even delete the original file, that does not affect the imported image.
So no, you cannot find out what and where the original image has been after importing!
But instead of using the images directly you can always use a BUTTON and set its ICON property to display different images dynamically!
That's what I do most of the time

@Zaxos
BEWARE: "imagesource" is a reserverd word!
Add a little c (for Custom property) in front of it and it will work -> the cImageSource of xyz
Best
Klaus
Re: file name and image source
Hi Klaus and Simon,
Thanks a lot to your help! I got it
Cheers,
Louis
Thanks a lot to your help! I got it

Cheers,
Louis