One Use Only Files

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: One Use Only Files

Post by bidgeeman » Fri Aug 18, 2017 12:08 am

Hi Klaus. Edit[SOLVED]
I'm tossing around multiple ideas for protecting my images. I have a poster designer and have a library of backgrounds that can be used to assemble a simple poster design with a bit of text and an imported photo. I have had already an experience of being pirated from a small shop where I sell a few bits and pieces of artwork. That system allows anyone to buy the actual design and download it. I'm sure you can imagine how it might feel to suddenly find someone is selling your work. (being a muso ;)

I would like to try and protect my images this time around but at the same time allow people to print out their customized versions of the poster. I've seen server hosted images that only allow images to stream but that means I would have to build an entire browser in my app so people can see what images are there. I'm not sure how to go about this but it seems like it could be a good solution. Also not sure what problems this might present, ie, people being offline, the amount of time it takes to download images to a gallery etc. Just after some advice from the experts on the forum like yourself.

Hope that helps explain.
Bidge

SparkOut
Posts: 2020
Joined: Sun Sep 23, 2007 4:58 pm

Re: One Use Only Files

Post by SparkOut » Fri Aug 18, 2017 6:57 am

Hi bidge
How about if you have a gallery of thumbnails that you import into the app, the user can browse these and choose the image to use. The image file can be "converted" by changing the filename extension and adding some "bidgebytes" before and after the binfile (and/or inverting some bytes as suggested earlier). Then any casual attempt to open the image will fail in a standard photo editor. When the user picks from the thumbnail gallery you can read in the binfile and reverse the "conversions" you imposed.
Does that seem feasible?

SparkOut
Posts: 2020
Joined: Sun Sep 23, 2007 4:58 pm

Re: One Use Only Files

Post by SparkOut » Fri Aug 18, 2017 6:57 am

Hi bidge
How about if you have a gallery of thumbnails that you import into the app, the user can browse these and choose the image to use. The image file can be "converted" by changing the filename extension and adding some "bidgebytes" before and after the binfile (and/or inverting some bytes as suggested earlier). Then any casual attempt to open the image will fail in a standard photo editor. When the user picks from the thumbnail gallery you can read in the binfile and reverse the "conversions" you imposed.
Does that seem feasible?

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: One Use Only Files

Post by bidgeeman » Fri Aug 18, 2017 7:01 am

Hi SparkOut.
That does seem like a great idea. I will do some experiments.
Many thanks
BidgeBytes :)

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: One Use Only Files

Post by bidgeeman » Sat Aug 19, 2017 1:29 am

Hi.
I am now trying to put my images online but this is quite new to me.

Attached is a small test stack I am playing with. So far I have managed to
get the file path of the images from a folder but I don't know how to
generate a new thumbnail container for the amount of files that are listed
in the folder as this is a variable. It's a bit harder than simply browsing for
a file :(
I know how to create a snapshot etc but I have not had to "Populate" a
varying amount of objects till now. I have spent hours looking for sample
image gallery stacks. The one in the LC Library does not seem to work?
Does anyone know of an image gallery stack I could look at for help?

Thanks
Bidge
Attachments
FilPathLister.zip
Lists the URL of all files in a directory.
(1.26 KiB) Downloaded 25 times

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: One Use Only Files

Post by bidgeeman » Sat Aug 19, 2017 6:58 am

Hi All.
I am progressing slowly and have managed to create an image gallery of sorts.
This stack will read a fold of png's then create a small gallery of images based
on the number of files it finds in the folder. I don't quite know how to export
snapshots of the actual images in the folder and place them in a grouped gallery
as yet.

Bidge
Attachments
FilePathListerB.zip
File path Lister and group creator
(3.16 KiB) Downloaded 24 times

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: One Use Only Files

Post by bidgeeman » Sat Aug 19, 2017 11:21 am

Hi.
I am stuck trying to write the correct code that places a link on a thumbnail image so when it is clicked it will load a larger version
of the thumb from another URL online. I can't seem to find the right term to look for. I tried "set textlink" but that will not work on
an image. Can someone please point me in the right direction?

Thanks
Bidge

bogs
Posts: 3810
Joined: Sat Feb 25, 2017 10:45 pm

Re: One Use Only Files

Post by bogs » Sat Aug 19, 2017 12:19 pm

Heya Bidge,

Not sure I really see what your trying to get to, but as a really simple example of what I *think* your shooting for, here is a picture of a stack with 2 images on it (note, the image containers are just containers, this could just as easily be a field of text, button, or just any random mouseUp event like clicking on the application).
Image
Image
On the smaller image (thumbnail, the image in the box won't matter for this example) :

Code: Select all

on mouseUp
    // substitute the url of the picture you are actually trying to put in there...
   put url "http://storage2.static.itmages.com/i/17/0630/h_1498783809_8590707_ff9ba92a73.png" into image "large"
end mouseUp
... and to clear the larger image, on the larger image mouseUp

Code: Select all

on mouseUp
   put "" into image "large"
end mouseUp
If your trying for something else, feel free to go into more detail.
Image

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: One Use Only Files

Post by bidgeeman » Sat Aug 19, 2017 12:30 pm

Hi bogs. Thanks for the reply :)
I have managed to sort out how to get images into a gallery with code, but at the end of the code I want to set each
image up as a button so that when they are clicked they will load in a larger image. The bit I don't know how to do with code
is set each image up as a button with a new loading url? ( I know how to set a button to load something manually but don't know how
to set this via code so that the image becomes a linked image. I do not want to change the thumbnail only make it a link that will load a larger image into image"large") What value of the image I need to set so it becomes a link?

I hope that makes it a bit clearer?


Thanks
Bidge

bogs
Posts: 3810
Joined: Sat Feb 25, 2017 10:45 pm

Re: One Use Only Files

Post by bogs » Sat Aug 19, 2017 1:05 pm

I am feeling impossibly dense here at the moment, so bear with me.

You have the images set up to load as thumbnails, so you already have the address of the full size image, and the image is resized smaller to look like a thumbnail, is that it?

You want someone to be able to click on the "thumbnail", and have it load the full size image as a full size image in a separate container.

I would use the code I posted above, you don't need to turn anything into a link since you already have the url you used to load the thumbnail. Just make the changes to use the url of the thumbnail image.

Or, alternately, I am still missing something that makes this improbable :(
Image

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: One Use Only Files

Post by bidgeeman » Sat Aug 19, 2017 1:30 pm

bogs wrote:
You want someone to be able to click on the "thumbnail", and have it load the full size image as a full size image in a separate container.
Yes...that's exactly what I want to do but set this up via code as the URL of the large image will be different from the thumbnail so I need to load the thumbnail then set it as a button so that when it is clicked it will load a separate URL of a larger image. So there will be two different URL's.


EDIT:

Code: Select all

put url "http://storage2.static.itmages.com/i/17/0630/h_1498783809_8590707_ff9ba92a73.png" into image "large"
This loads another image into image "large".
This IS what I want to do but the image must stay the same (as it has its own URL like Thumbnails) and I need to set the thumbnail image up as a link to load a different image (from a different URL like Large Images)

Is there a way to set the thumbnail up as a button that will do this on the fly?

There must be a way to do this as you can see in my previous stack I generated 6 buttons with the "create" function. So if they can be generated they must be able to be generated to also do something? If this is possible you must be able to set a similar parameter for an image?


Bidge

bogs
Posts: 3810
Joined: Sat Feb 25, 2017 10:45 pm

Re: One Use Only Files

Post by bogs » Sat Aug 19, 2017 3:43 pm

I almost hate to use the word 'assume', but am going to here :P
I assume you have some naming convention for your thumbnails that links them to the larger image, such as a list of links or some such.

You don't have to turn the thumbnail into a button, I'd stop chasing down that alley. Use either the mouseDown or mouseUp event to tie that link to the larger image and just put that into the large image container.

Something like (psuedo code)

Code: Select all

// instead of a button, set the mouseUp code to your thumbnail image...
on mouseUp
     get the (whatever format your referral link is in) of image "thisThumbnailImage" 
      put url "http://(your referral link)" into image "thisIsMyBigImage"
end mouseUp
All the other stuff you mention seems to be over complicating the problem/solution. From what you wrote, you don't need any more than the thumbnail itself to click on, and you wrote the code for that so you should be able to identify it in a mouse up event.

If you really want to make sure which thumbnail they clicked on, pass the mouse event and put the code in the card or stack level, then you can use the long name, the long id, or other identifiers to make sure which one got the mouse event.
Image

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2123
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: One Use Only Files

Post by [-hh] » Sat Aug 19, 2017 3:45 pm

Just try this.
Script the thumbnails after you created and loaded them (best also done by scripts):

Code: Select all

on mouseUp
  set script of img "thumbnail1" to setScript("http://path/to/my/large/png1")
  set script of img "thumbnail2" to setScript("http://path/to/my/large/png2")
end mouseUp

function setScript largeURL
  return  "on mouseUp" &CR& \
        "   put url (" &quote& largeURL &quote& ") into image " &quote& "large" &quote& "" &CR& \
        "end mouseUp"
end setScript
Edit. Was some overcrossing here. This is the same as the proposal of 'bogs', but scripted.
shiftLock happens

bogs
Posts: 3810
Joined: Sat Feb 25, 2017 10:45 pm

Re: One Use Only Files

Post by bogs » Sat Aug 19, 2017 4:03 pm

-hh, I trust your shot at it more than my own, off the top of my head fuzzy logic :mrgreen:

Bidge, what -hh said !
Image

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: One Use Only Files

Post by bidgeeman » Sun Aug 20, 2017 12:16 am

Hi bogs and [-hh]
Setscript and a function. That is what I was after :)
Being a newbie I had no idea how to go about setting a mouse event inside an object using code.
Thanks to both of you for those great pointers.

Regards
Bidge

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”