If I choose a small jpeg and do a conversion online , then I get a rather long string.
Is this correct ? And can I just copy paste this long string into 1 (princ …) instruction , or do I have to cut it into pieces ?
The number of characters in the Base64 string will be 4/3 times the size of the file in bytes. GIF would be a better file format as it tends to give smaller files. In theory you can paste it the string into one princ instruction, as uLisp doesn’t have any limit on the length of strings it supports, but uLisp may run out of memory allocating space for such a long string so it might be safer to break it into pieces. Some Base 64 converters split the string up into pieces for you.
Yes, you could read the Base 64 string encoding for the image from an SD card, and it won’t take up memory in uLisp. You could also store the actual image on the SD card, and Base 64 encode it each time you use it using the uLisp function for Base 64 encoding.
This piece of code is running inside a (with-client (s) form.
Image.txt is a file on sd-card which contains a text in base64 which is the image (giff, bmd, tiff or whatever) converted to base64 and added with html tags.
I have an image of lets say a first quarter image of the moon and the contents of the file look like this :