Best way to base64encode a jpeg file ?
Bob Sneidar
bobsneidar at iotecdigital.com
Thu Feb 6 11:28:55 EST 2025
I don’t see any of those characters on base64encoded strings.
Bob S
> On Feb 5, 2025, at 5:43 AM, Ralph DiMola via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> I can see getting rid of extraneous CRs or LFs but aren’t "+","/" and "=" part of the encoding and corrupt the base 64 data stream? Or am I missing something?
>
> Ralph DiMola
> IT Director
> Evergreen Information Services
> rdimola at evergreeninfo.net
>
> -----Original Message-----
> From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf Of Monte Goulding via use-livecode
> Sent: Wednesday, February 05, 2025 4:36 AM
> To: How to use LiveCode
> Cc: Monte Goulding
> Subject: Re: Best way to base64encode a jpeg file ?
>
> Hi jbv
>
>> Here is my code for base64 encoding :
>> put URL ("file:" & "myfile.jpg") into timagedata
>
> Use `binfile:` here instead of `file:` so the engine doesn’t treat the data as native text and fiddle with it
>
>> put base64encode(timagedata) into tBase64Image replace return with
>> "" in tBase64Image
>
> You need url safe base64 encoding so you need:
>
> local tEncoded
> put base64Encode(pData) into tEncoded
> replace return with empty in tEncoded
> replace "+" with "-" in tEncoded
> replace "/" with "_" in tEncoded
> replace "=" with empty in tEncoded
>
>>
>> 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
>
>
> _______________________________________________
> 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
>
>
> _______________________________________________
> 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