Best way to base64encode a jpeg file ?
Bob Sneidar
bobsneidar at iotecdigital.com
Thu Feb 6 11:04:42 EST 2025
Well then that is now a function in my conversions library:
function urlSafeBase64 pData
replace return with empty in pData
replace "+" with "-" in pData
replace "/" with "_" in pData
replace "=" with empty in pData
return pData
end urlSafeBase64
Bob S
> On Feb 6, 2025, at 5:50 AM, jbv via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> Hi Monte,
>
> It works ! Thank you very much !
>
> jbv
>
> Le 2025-02-05 04:35, Monte Goulding via use-livecode a écrit :
>> 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
>
> _______________________________________________
> 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