One more question about Rev cgi & binary data
Richard Miller
wow at together.net
Sat Apr 26 13:41:21 EDT 2008
JB,
I've found a stack script more flexible that a text script, and it
takes only a few minutes to convert from text to stack.
Best,
Richard
On Apr 26, 2008, at 12:56 PM, jbv wrote:
>
>
> Richard,
>
> Thank for the script, but your method implies the use of a cgi
> stack... what if a plain text script is used ?
> Actually, I'm looking towards a php solution right now...
>
> Best,
> JB
>
>> JB,
>>
>> Here's the solution which works for me. I know it seems a bit
>> bizarre. It took many attempts to figure out how to get it to work
>> reliably. But this works all the time.
>>
>> Best,
>> Richard Miller
>>
>> ---------------------------
>> -- buffer has the incoming data stream
>> put buffer into temp
>> put empty into pictfile
>> put offset("image/jpeg",temp) into xx
>> if xx <> 0 then
>> put xx+14 into xx
>> put char xx to (the length of temp) of temp into pictdata
>> put char 1 to xx-1 of temp into tdata
>> repeat with i = the length of pictdata down to 1
>> if chartonum(char i of pictdata) is 0 then
>> put i into holdit
>> exit repeat
>> end if
>> end repeat
>> delete char (holdit+1) to the length of pictdata of pictdata
>> put "binfile:TempPict_" & the milliseconds & ".jpg" into
>> PictFile
>> -- these next steps are critical. It doesn't work otherwise.
>> Field "temp2" is just an empty text field on the cgi stack
>> put pictdata into url PictFile
>> put url PictFile into pictdata
>> put pictdata into fld "temp2"
>> put fld "temp2" into url PictFile
>>
>> The file PictFile will now be a regular jpeg file you can read and
>> manipulate as you would any jpeg file
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list