Photo Library

Peter M. Brigham pmbrig at gmail.com
Tue Nov 26 14:55:22 EST 2013


On Nov 26, 2013, at 5:14 AM, Sergio Schvarstein wrote:

> After the picture is imported, do you know how can I do to keep it inside the stack, so I can see it after closing and reopening ?
> Can I save it in some way ? Which commands can be involved in this operation ?

By coincidence, this is just the problem I was solving with my standalone. First you should realize that if you store images in a stackfile and there are lots and lots of them, your stackfile will grow in size enormously. I would not store more than a few dozen full-size images within a stack. Much better to use references to image files that reside on disk or on the web.

Having said that, what I did to store images was to "put url ("binfile:" & imageFilePath) into tImageData" then store tImageData as a customprop. You have to make sure that you save and store the file extension/file type as well, ".jpg", "PDF," etc. All the image  data will be saved with the stack. Then to display the image, fetch the image data out of the customprop, write it to the (specialfolderpath("temporary") folder, making sure that the file name uses the correct file extension, then launch the temporary file, which will open the image with the default image app for the OS.

If you want to display the image entirely within LC, you'll have to use an image display substack or a browser instance, but this is more difficult, since you have to know and store the dimensions of the original image.

I'm sure others have solutions as well, maybe more elegant and flexible than what I put together….

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig





More information about the use-livecode mailing list