use-livecode Digest, Vol 257, Issue 1
Neville Smythe
Neville.Smythe at optusnet.com.au
Mon Feb 3 21:34:16 EST 2025
Urlencode(base64encode(stuff))???
I dont think you want to remove the line feeds, but encode them for http transmission
$@%?$@%?$@%?$@%?$@%?$@%?$@%?$@%?
Neville Smythe
Director, International Go Federation
VicePresident, Australian Go Association Inc.
> On 4 Feb 2025, at 4:01 am, use-livecode-request at lists.runrev.com wrote:
> Send use-livecode mailing list submissions to
> use-livecode at lists.runrev.com
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.runrev.com/mailman/listinfo/use-livecode
> or, via email, send a message with subject or body 'help' to
> use-livecode-request at lists.runrev.com
>
> You can reach the person managing the list at
> use-livecode-owner at lists.runrev.com
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of use-livecode digest..."
>
>
> you can find the archives for this list at:
>
> http://lists.runrev.com/pipermail/use-livecode/
>
> and search them using this link:
>
> https://www.mail-archive.com/use-livecode@lists.runrev.com/
>
>
> Today's Topics:
>
> 1. Best way to base64encode a jpeg file ? (jbv at souslelogo.com)
> 2. Re: Best way to base64encode a jpeg file ? (Alex Tweedly)
> 3. Re: Best way to base64encode a jpeg file ? (Richard Gaskin)
> 4. Re: Best way to base64encode a jpeg file ? (jbv at souslelogo.com)
> 5. Interacting locally with LC and AI models (jbv at souslelogo.com)
> 6. Re: Best way to base64encode a jpeg file ? (Bob Sneidar)
> 7. Re: Best way to base64encode a jpeg file ? (jbv at souslelogo.com)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sun, 02 Feb 2025 14:14:57 -0500
> From: jbv at souslelogo.com
> To: How to use LiveCode <use-livecode at lists.runrev.com>
> Subject: Best way to base64encode a jpeg file ?
> Message-ID: <829be9080c24e2a5ae5fb7478c4d1066 at souslelogo.com>
> Content-Type: text/plain; charset=US-ASCII; format=flowed
>
> Hi list,
>
> I need to base64encode a serie of jpeg files to include
> the code in a curl request.
> What is the best way to do that ?
> Do I need to import each file into an image control and
> base64encode the "text" of the image ?
>
> Thank you,
> jbv
>
>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 3 Feb 2025 00:44:45 +0000
> From: Alex Tweedly <alex at tweedly.net>
> To: use-livecode at lists.runrev.com
> Subject: Re: Best way to base64encode a jpeg file ?
> Message-ID: <0cbef31f-dfad-40e2-9ad1-6f406254eb17 at tweedly.net>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> Why not just something like
>
> repeat for each line L in tFilePathNames
>
> ??? put url ("binfile:" & L) into tmp
>
> ??? put base64encode(tmp) after tWhatever
>
> end repeat
>
> Alex.
>
> On 02/02/2025 19:14, jbv via use-livecode wrote:
>> Hi list,
>>
>> I need to base64encode a serie of jpeg files to include
>> the code in a curl request.
>> What is the best way to do that ?
>> Do I need to import each file into an image control and
>> base64encode the "text" of the image ?
>>
>> Thank you,
>> jbv
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
>
> ------------------------------
>
> Message: 3
> Date: Mon, 03 Feb 2025 02:10:58 +0000
> From: "Richard Gaskin" <ambassador at fourthworld.com>
> To: use-livecode at lists.runrev.com
> Subject: Re: Best way to base64encode a jpeg file ?
> Message-ID: <34ae27543c1fa3f5dba848dec746e5eb51cc41d3 at fourthworld.com>
> Content-Type: text/plain; charset="utf-8"
>
> jbv wrote:
>
>> I need to base64encode a serie of jpeg files to include
>> the code in a curl request.
>> What is the best way to do that ?
>
> Depends. What's on the receiving end, and what options does it support?
>
> --
> Richard Gaskin
> FourthWorld.com
>
>
>
> ------------------------------
>
> Message: 4
> Date: Mon, 03 Feb 2025 03:25:54 -0500
> From: jbv at souslelogo.com
> To: How to use LiveCode <use-livecode at lists.runrev.com>
> Subject: Re: Best way to base64encode a jpeg file ?
> Message-ID: <039f0da859345f629184bc4a4fa69ff8 at souslelogo.com>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> Le 2025-02-02 21:10, Richard Gaskin via use-livecode a ?crit?:
>> jbv wrote:
>>
>>> I need to base64encode a serie of jpeg files to include
>>> the code in a curl request.
>>> What is the best way to do that ?
>>
>> Depends. What's on the receiving end, and what options does it
>> support?
>
> Actually, my question was not about the serie of files, but rather how
> to base64encode the relevant data of each jpeg file.
> I tried to open a file and encode it, but it was rejected in the curl
> request, so I assumed that unnecessary extra data had been added.
> The idea of importing the files into an image control came from this
> forum post : https://forums.livecode.com/viewtopic.php?t=24274
> in which someone suggested this :
> put the text of image "thumbnail" into temp
> put base64encode(temp) into image_base64
>
> The syntax of the multimodal curl I am using is as follow :
> {"type": "image_url", "image_url":
> "data:image/jpeg;base64,ENCODED_IMAGE_HERE"}
>
> Thanks,
> jbv
>
>
>
> ------------------------------
>
> Message: 5
> Date: Mon, 03 Feb 2025 04:11:30 -0500
> From: jbv at souslelogo.com
> To: How to use LiveCode <use-livecode at lists.runrev.com>
> Subject: Interacting locally with LC and AI models
> Message-ID: <09ded88ef4de0dcbb293c7d7967d0d6c at souslelogo.com>
> Content-Type: text/plain; charset=US-ASCII; format=flowed
>
> Hi list,
>
> Someone asked me privately, so I thought that maybe others
> would be interested in a simple way to interact between LC
> and AI models locally on their machine.
>
> The method uses Ollama, which is available for Mac, Win and
> Linux : https://ollama.com
>
> 1- Download and install Ollama (plenty of tutorials on youtube)
>
> 2- run Ollama via Terminal (on Mac) :
> ollama serve
>
> 3- load a model via Terminal (from HuggingFace for instance) :
> ollama run llama3.2:1b
>
> 4- in a livecode stack, create a field with the following content :
> curl -X POST http://localhost:11434/api/generate \
> -H "Content-Type: application/json" \
> -d '{
> "model": "llama3.2:1b",
> "prompt": "What is the capital of France ?",
> "stream": false
> }'
>
> 5- create a button with the following script :
> on mouseup
> put field 1 into tcurl
> put shell(tcurl)
> end mouseup
>
> 6- the answer from the model displays in the message box in json format.
>
> This works great on machines with a GPU and at least 16 Gb of RAM.
> The more RAM, the bigger the models that can be used.
>
> Enjoy,
> jbv
>
>
>
> ------------------------------
>
> Message: 6
> Date: Mon, 3 Feb 2025 16:07:26 +0000
> From: Bob Sneidar <bobsneidar at iotecdigital.com>
> To: How to use LiveCode <use-livecode at lists.runrev.com>
> Subject: Re: Best way to base64encode a jpeg file ?
> Message-ID: <1A43F3B2-FAE7-407E-A658-55EA9BDED09F at iotecdigital.com>
> Content-Type: text/plain; charset="utf-8"
>
> I heard that the base64encode puts a carriage return at a certain interval of characters (not sure how many).
>
> Bob S
>
>
>> On Feb 3, 2025, at 12:25 AM, jbv via use-livecode <use-livecode at lists.runrev.com> wrote:
>>
>> Le 2025-02-02 21:10, Richard Gaskin via use-livecode a ?crit :
>>> jbv wrote:
>>>> I need to base64encode a serie of jpeg files to include
>>>> the code in a curl request.
>>>> What is the best way to do that ?
>>> Depends. What's on the receiving end, and what options does it support?
>>
>> Actually, my question was not about the serie of files, but rather how
>> to base64encode the relevant data of each jpeg file.
>> I tried to open a file and encode it, but it was rejected in the curl
>> request, so I assumed that unnecessary extra data had been added.
>> The idea of importing the files into an image control came from this
>> forum post : https://forums.livecode.com/viewtopic.php?t=24274
>> in which someone suggested this :
>> put the text of image "thumbnail" into temp
>> put base64encode(temp) into image_base64
>>
>> The syntax of the multimodal curl I am using is as follow :
>> {"type": "image_url", "image_url": "data:image/jpeg;base64,ENCODED_IMAGE_HERE"}
>>
>> Thanks,
>> jbv
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ------------------------------
>
> Message: 7
> Date: Mon, 03 Feb 2025 11:19:38 -0500
> From: jbv at souslelogo.com
> To: How to use LiveCode <use-livecode at lists.runrev.com>
> Subject: Re: Best way to base64encode a jpeg file ?
> Message-ID: <62bcea2d8d892196a7365a270368bce6 at souslelogo.com>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> Le 2025-02-03 11:07, Bob Sneidar via use-livecode a ?crit?:
>> I heard that the base64encode puts a carriage return at a certain
>> interval of characters (not sure how many).
>>
>> Bob S
>
> Yes, that's true, but even when I removed the returns it didn't work.
>
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ------------------------------
>
> End of use-livecode Digest, Vol 257, Issue 1
> ********************************************
More information about the use-livecode
mailing list