Page 1 of 4
One Use Only Files
Posted: Wed Aug 16, 2017 10:39 am
by bidgeeman
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
Re: One Use Only Files
Posted: Wed Aug 16, 2017 10:41 am
by Klaus
Please define "1 time only use"!

Re: One Use Only Files
Posted: Wed Aug 16, 2017 10:44 am
by bidgeeman
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
Re: One Use Only Files
Posted: Wed Aug 16, 2017 11:11 am
by bidgeeman
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
Re: One Use Only Files
Posted: Wed Aug 16, 2017 11:30 am
by Klaus
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:
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
Works of course with ALL kind of files.
Hope that gets you started!
Best
Klaus
Re: One Use Only Files
Posted: Wed Aug 16, 2017 12:10 pm
by bidgeeman
Hi Klaus.
Thanks

I will experiment with this and see how it goes.
Bidge
Re: One Use Only Files
Posted: Wed Aug 16, 2017 12:16 pm
by Klaus
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
Posted: Wed Aug 16, 2017 12:36 pm
by bidgeeman
Oh dear.
Back to the drawing board

Bidge
Re: One Use Only Files
Posted: Wed Aug 16, 2017 3:55 pm
by dunbarx
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
Re: One Use Only Files
Posted: Wed Aug 16, 2017 8:44 pm
by [-hh]
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.
Re: One Use Only Files
Posted: Wed Aug 16, 2017 11:48 pm
by bidgeeman
Hi dunbarx and [-hh]
They sound like good options. I will experiment with both and let you know how it goes.
Thanks again
Bidge
Re: One Use Only Files
Posted: Thu Aug 17, 2017 12:54 am
by dunbarx
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
Re: One Use Only Files
Posted: Thu Aug 17, 2017 1:15 am
by bidgeeman
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
Re: One Use Only Files
Posted: Thu Aug 17, 2017 3:07 am
by bidgeeman
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
Re: One Use Only Files
Posted: Thu Aug 17, 2017 5:47 pm
by Klaus
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.
