Best way to base64encode a jpeg file ?

jbv at souslelogo.com jbv at souslelogo.com
Mon Feb 3 03:25:54 EST 2025


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



More information about the use-livecode mailing list