livecode server and import snapshot with on-rev

Are you using LiveCode to create server scripts or CGIs?

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1682
Joined: Sat Feb 28, 2009 11:49 pm

livecode server and import snapshot with on-rev

Post by sturgis » Sun Nov 02, 2014 5:50 pm

Just curious, is import snapshot no longer working? Using server and on-rev I mean. I know it was working before (David Williams used it during a session at the conference) but trying some things now just don't seem to work.
I can create a stack, go to the stack, create a button, (and confirm that its there) but creating an image from that button (import snapshot from button "mybutton") causes the rest of my script to disappear into the ether. Commenting it out lets the rest of the script work. I can't even look at 'it' and 'the result' to see whats up. I do have inline debugging turned on.

Suggestions?

Heres a script explaining what I wish to do.

Code: Select all

<?lc set the errormode to "inline"?>

<pre>
<?lc
put version() && return  -- this works
create stack "mytest" -- stack creation works. 
go stack "mytest" -- as does this as shown by the next line
put the short name of the current stack --yep
create button "mybutton" -- also works as shown by next line
put the result
set the label of button "myButton" to "my test"
-- if I place a put here before the import,it also works.
import snapshot from button "myButton"
-- nothing past here is reached.  If I comment out the import, then things are fine
put it &  the result -- can't get the result cause apparently, server dies.

--If all worked well before, this would shove the pic data into a variable and encode it
put base64encode((the text of img 1)) into tPic 

--Assuming we reached this stage,
--it would place an image onto the page (of the button)
--using the base64 encoded data.  Since LC native format is png, 
-- specify that as the mime type, and specify the base64 encoding. 
put merge("<img alt=[[quote]][[quote]] src=[[quote]]data:image/png;base64,[[tPic]][[quote]] />")
?>
Any and all suggestions to help would be appreciated.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1682
Joined: Sat Feb 28, 2009 11:49 pm

Re: livecode server and import snapshot with on-rev

Post by sturgis » Sun Nov 02, 2014 6:04 pm

Just did a test to see if what i'm attempting will work (other than the import)

I created the stack mytest.livecode in lc, created an image, saved stack, uploaded it next to the script and then did the following.

Code: Select all

go stack "mytest.livecode" -- my pre-created stack
put base64encode((the text of img 1)) into tPic -- encode the image
put merge("<img alt=[[quote]][[quote]] src=[[quote]]data:image/png;base64,[[tPic]][[quote]] />") -- place the image
All works dandy, so if I can get past the import impass, i'm good to go.

ALso am curious.. if instead of base64 encoding, wondering if I can zip the data (after import) and store the (now smaller) data in a database. Then retrieve it and display it as above, on the fly. Does anyone know if its possible to do in memory data compression? Compressing a variable would be pretty snazzy.

Post Reply

Return to “CGIs and the Server”