One Use Only Files
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
One Use Only Files
Hi again.
Thought I should start a new thread on this as the other image thread was getting quite large.
Can anyone suggest a way to limit a file, (Image), to 1 time only use in a stack? Even if they
user has made a copy of it?
Bidge
Thought I should start a new thread on this as the other image thread was getting quite large.
Can anyone suggest a way to limit a file, (Image), to 1 time only use in a stack? Even if they
user has made a copy of it?
Bidge
Re: One Use Only Files
Please define "1 time only use"!
Re: One Use Only Files
1 time only use = they load it into the stack and use it as much as they like until they load in another image then the old one would be replaced and deleted. But if they had made a copy of the old file they could easily reload it again and again and again, share it etc. I'm probably asking the impossible once again.
Bidge
Bidge
Re: One Use Only Files
Just throwing ideas around. What I time stamped and made a duplicate of the file when it was first loaded ,and only allowed that time stamped copy to be used till another file was loaded? Can anyone find fault in that method? Hoe would I keep track in the software not to load that file ever again though? If it worked off an internal list that list would get huge over time.
Bidge
Bidge
Re: One Use Only Files
Hi David,
mod date etc. can be modified.
I think you will show a file dialog to the user so he can select an image file right?
In that case I would only save and compare the MD5DIGEST of the files!
Hint: md5digest() returns BINARY data, need I say more?
A quick test worked fine:
Works of course with ALL kind of files.
Hope that gets you started!
Best
Klaus
mod date etc. can be modified.
I think you will show a file dialog to the user so he can select an image file right?
In that case I would only save and compare the MD5DIGEST of the files!
Hint: md5digest() returns BINARY data, need I say more?
A quick test worked fine:
Code: Select all
on mouseUp pMouseButton
answer file "select img 1"
put md5digest(url("binfile:" & IT)) into md1
answer file "select img 2"
put md5digest(url("binfile:" & IT)) into md2
answer md1 = md2
end mouseUp
Hope that gets you started!
Best
Klaus
Re: One Use Only Files
Hi Klaus.
Thanks I will experiment with this and see how it goes.
Bidge
Thanks I will experiment with this and see how it goes.
Bidge
Re: One Use Only Files
Hm, another test showed that a copy of a file has the same md5digest as the original file, so that was a quick but not so good idea, I'm afraid...
Re: One Use Only Files
Oh dear.
Back to the drawing board
Bidge
Back to the drawing board
Bidge
-
- VIP Livecode Opensource Backer
- Posts: 9665
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: One Use Only Files
Hi.
Might it be possible to store the imageData of each newly uploaded image, perhaps in a custom property of the stack, and then if any new image's imageData matched an instance in storage, simply destroy the computer.
Craig Newman
Might it be possible to store the imageData of each newly uploaded image, perhaps in a custom property of the stack, and then if any new image's imageData matched an instance in storage, simply destroy the computer.
Craig Newman
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: One Use Only Files
Another option could be:
1. For displaying the proper image hide it and copy it to a temporary image . Then set byte 1 to 5 of the alphaData of the image to "BIDGE". By that, if the image is copied, it is copied with that alphaData. (This will be also copied by LC to byte 1 of the first 5 pixels = bytes 1,5,9,13,17 of the imageData, that's why you always have to set the alphaData before the imageData).
2. Now, if you have loaded a new image then check byte 1 to 5 of the alphaData (or bytes 1,5,9,13,17 of the imageData) before the display.
If it is "BIDGE" then don't display the image, else assume it is proper and do 1.
You could also use e.g. the last pixels and another word. Nobody knows.
1. For displaying the proper image hide it and copy it to a temporary image . Then set byte 1 to 5 of the alphaData of the image to "BIDGE". By that, if the image is copied, it is copied with that alphaData. (This will be also copied by LC to byte 1 of the first 5 pixels = bytes 1,5,9,13,17 of the imageData, that's why you always have to set the alphaData before the imageData).
2. Now, if you have loaded a new image then check byte 1 to 5 of the alphaData (or bytes 1,5,9,13,17 of the imageData) before the display.
If it is "BIDGE" then don't display the image, else assume it is proper and do 1.
You could also use e.g. the last pixels and another word. Nobody knows.
shiftLock happens
Re: One Use Only Files
Hi dunbarx and [-hh]
They sound like good options. I will experiment with both and let you know how it goes.
Thanks again
Bidge
They sound like good options. I will experiment with both and let you know how it goes.
Thanks again
Bidge
-
- VIP Livecode Opensource Backer
- Posts: 9665
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: One Use Only Files
Thinking about storing the imageData for all these imported pictures, surely, to keep the thing from getting too large, might you store only the first 1K?
Craig
Craig
Re: One Use Only Files
Hi dunbarx,
yes...It's really only a deterrent to the average person. One other question. Is it possible to run a Livecode stack from a server? Maybe a html 5 version of a stack? That way you could theoretically insert a code in each image before it was downloaded.
Bidge
yes...It's really only a deterrent to the average person. One other question. Is it possible to run a Livecode stack from a server? Maybe a html 5 version of a stack? That way you could theoretically insert a code in each image before it was downloaded.
Bidge
Re: One Use Only Files
Just thinking....would it be simpler to protect the images if they were hosted on a website and just downloaded into the background area of the poster when required? That way there are no files exchanged physically? Any thoughts or pitfalls on this?
Bidge
Bidge
Re: One Use Only Files
Hm, in your second posting you said the user will load an image into the stack and
now you want to load the images from the server, which is exactly the contrary!?
Maybe you should tell us a bit more about your app, I still don't have the slightest idea.
now you want to load the images from the server, which is exactly the contrary!?
Maybe you should tell us a bit more about your app, I still don't have the slightest idea.