Best way to base64encode a jpeg file ?
Bob Sneidar
bobsneidar at iotecdigital.com
Mon Feb 3 11:07:26 EST 2025
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
More information about the use-livecode
mailing list